alexschimpf / fastapi-versionizer

FastAPI Versionizer
MIT License
79 stars 13 forks source link

Missing API Metadata in versioned docs #38

Closed worldworm closed 11 months ago

worldworm commented 11 months ago

Subject of the issue

I noticed that all metadata of an API is displayed in the "main" documentation ("/swagger"). However, as soon as a versioned documentation ("/v1/swagger") is called, it is missing.

Your environment

Steps to reproduce

overwrite app in examples/simple.py

app = FastAPI(
    title='test',
    docs_url='/swagger',
    openapi_url='/api_schema.json',
    redoc_url=None,
    description='This is a very long description of my API.',
    summary='This is a short summary of my API.',
    contact={
        'name': 'SourceCode Github repository',
        'url': 'https://github.com/alexschimpf/fastapi-versionizer'
    },
    terms_of_service='https://example.com',
    license_info={
        'name': 'MIT',
        'url': 'https://opensource.org/licenses/MIT'
    },
)

Expected behaviour

That's exactly the question why I'm creating an issue on github instead of making a pull request directly. I am aware of the "Docs Customization" part in the readme. I would assume, however, that in the normal case the metadata is transferred to all docs and I only have to touch the callback if I want to have different metadata in different versions.

What is your opinion? I would be happy to create a pull request here so that all metadata is transferred by default.

one more thing: If you agree to the above, should I also take over the "summary"? This attribute is only available since FastAPI 0.99.0 and according to your requirements.txt you still support down to 0.86.0.

Actual behaviour

/swagger /v1/swagger
grafik grafik
alexschimpf commented 11 months ago

Good catch! Yeah, pull requests are encouraged forsure. It would be great if we could support summary in more recent FastAPI versions, yet simultaneously not break things in older versions.

alexschimpf commented 11 months ago

:tada: This issue has been resolved in version 2.1.4 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: