Skip to content

API client READMEs have broken documentation links when published to package repositories #161

@nickls

Description

@nickls

Problem

The Python client's README.md contains relative links to documentation files that don't work when viewed on PyPI.

Example from current README:

| _CardScanApi_ | [**create_card**](docs/CardScanApi.md#create_card) | **POST** /cards | Creates a new card |

When viewed on PyPI (https://pypi.org/project/cardscan-client/), these links try to resolve to:
https://pypi.org/project/cardscan-client/docs/CardScanApi.md

This results in 404 errors because PyPI doesn't host the documentation files.

Current Impact

All documentation links in the API methods table and models table are broken on PyPI, making it difficult for users to find detailed documentation.

Proposed Solutions

Option 1: Convert to absolute GitHub URLs

Update the template to generate absolute URLs:

| _CardScanApi_ | [**create_card**](https://github.com/CardScan-ai/api-clients/blob/main/clients/cardscan-python/docs/CardScanApi.md#create_card) | **POST** /cards | Creates a new card |

Option 2: Post-process during packaging

Add a script that converts relative links to absolute GitHub URLs when building for PyPI:

# In setup.py or pyproject.toml build process
readme_content = readme_content.replace(
    "](docs/",
    "](https://github.com/CardScan-ai/api-clients/blob/main/clients/cardscan-python/docs/"
)

Option 3: Remove links from PyPI version

Have a separate README for PyPI that removes the links and directs users to GitHub for full documentation.

Recommendation

Option 1 is probably best - update the Mustache template to generate absolute URLs. This ensures links work everywhere (GitHub, PyPI, local) without requiring build-time processing.

This issue likely affects other generated clients as well if they're published to package repositories.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions