Closed isaacharrisholt closed 4 months ago
Heard about it before. Will likely publish the fix today.
Could you help me out with a reproducible example?
Sure!
from datetime import date
from cadwyn import Cadwyn
from cadwyn.structure import VersionBundle, Version
from .data import latest
def generate_openapi_id(route: APIRoute) -> str:
print(route)
if not route.tags:
return route.name
return f'{str(route.tags[0]).lower().replace(' ', '_')}:{route.name}'
versions = VersionBundle(
Version(date(2024, 3, 5)),
latest_schemas_package=latest
)
app = Cadwyn(
versions=versions,
generate_unique_id_function=generate_openapi_id,
)
@app.get('/', tags=['misc'])
def home():
return 'Helo, byd!'
If you run this and go to the docs URL, you'll notice that the URL for the /
does not end in misc:home
like it should.
@isaacharrisholt Fixed everything related to this in 3.12.0. Please, check :pray:
Yep! Seems to work
Describe the bug
The
generate_unique_id_function
kwarg forFastAPI
is used in the OpenAPI schema for routing. It doesn't seem to work with Cadwyn.