@get(raises=[NotFoundException])
def endpoint(): ...
...seems to inject each declared raises
entry as duplication into the generated OpenAPI spec:
"404": {
"description": "Nothing matches the given URI",
"content": {
"application/json": {
"schema": {
"properties": {
"status_code": {
"type": "integer"
},
"detail": {
"type": "string"
},
"extra": {
"additionalProperties": {},
"type": [
"null",
"object",
"array"
]
}
},
"type": "object",
"required": [
"detail",
"status_code"
],
"description": "Not Found Exception",
"examples": {
"NotFoundException": {
"value": {
"status_code": 404,
"detail": "Not Found",
"extra": {}
}
}
}
}
}
}
},
That's quite lengthy, consider 100 endpoints and it's going to be there 100 times.
Could these be injected into the components section, rather:
"components": {
"schemas": {
"NotFoundException": {
"description": "Not Found Exception",
"type": "object",
"properties": {
"status_code": {
"type": "integer"
},
"detail": {
"type": "string"
},
"extra": {
"additionalProperties": {},
"type": [
"null",
"object",
"array"
]
}
},
"required": [
"detail",
"status_code"
],
"examples": {
"NotFoundException": {
"value": {
"status_code": 404,
"detail": "Not Found",
"extra": {}
}
}
}
Then the references much become much shorter:
"404": {
"description": "Nothing matches the given URI",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/NotFoundException"
}
}
}
},
No response
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too