You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now it is impossible to customise schema without subclassing QuartSchema and using it everywhere. E.g. I needed to add operationId to my schema, and the only way is to manually change generated schema in the overridden QuartSchema.openapi method.
My proposal is to provide extension points so users can change schema during generation time. This may look like the following:
def method_schema_generator():
# some magic decorator provided by library which does the following:
# 1. Registers user-defined extension in the method
# 2. Wraps extension in a way to pass schema during generation time, so user can "bind" all other arguments
#
# Then during schema generation step QuartSchema calls registered extension
# passing schema to it along with all arguments bound by user
...
# user-defined extension
@method_schema_generator
def operation_id(value, schema):
schema['operationId'] = value
# usage
@app.post("/")
@validate_request(Todo)
@validate_response(Todo, 201)
@operation_id("create_todo")
async def create_todo(data: Todo) -> tuple[Todo, int]:
...
The text was updated successfully, but these errors were encountered:
Right now it is impossible to customise schema without subclassing
QuartSchema
and using it everywhere. E.g. I needed to addoperationId
to my schema, and the only way is to manually change generated schema in the overriddenQuartSchema.openapi
method.My proposal is to provide extension points so users can change schema during generation time. This may look like the following:
The text was updated successfully, but these errors were encountered: