Browse Source

Sort schemas alphabetically (#554)

Modify openapi spec generation to include schemas in alphabetical order.
pull/593/head
dmontagu 6 years ago
committed by Sebastián Ramírez
parent
commit
5fd83c5fa4
  1. 2
      fastapi/openapi/utils.py

2
fastapi/openapi/utils.py

@ -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…
Cancel
Save