mirror of https://github.com/tiangolo/fastapi.git
✨ Sort schemas alphabetically (#554)
Modify openapi spec generation to include schemas in alphabetical order.
This commit is contained in:
parent
14daaf409f
commit
5fd83c5fa4
|
|
@ -283,7 +283,7 @@ def get_openapi(
|
||||||
if path_definitions:
|
if path_definitions:
|
||||||
definitions.update(path_definitions)
|
definitions.update(path_definitions)
|
||||||
if definitions:
|
if definitions:
|
||||||
components.setdefault("schemas", {}).update(definitions)
|
components["schemas"] = {k: definitions[k] for k in sorted(definitions)}
|
||||||
if components:
|
if components:
|
||||||
output["components"] = components
|
output["components"] = components
|
||||||
output["paths"] = paths
|
output["paths"] = paths
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue