Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't sort YAML keys #6680

merged 2 commits into from Jun 9, 2019


Copy link

@n2ygk n2ygk commented May 15, 2019


This adds a new PyYAML >= 5.1 feature to suppress sorting the dict when dumping to yaml.
This makes the openapi.yaml file more human-readable with keys appearing in the order they were added.

@carltongibson another candidate for 3.10?

Copy link

tomchristie commented May 15, 2019

Oh that sounds like a neat one!

@carltongibson carltongibson added this to the 3.10 Release milestone May 16, 2019
Copy link

@carltongibson carltongibson left a comment

OK, super yes. Thanks. 👍

@carltongibson carltongibson merged commit 4d22825 into encode:master Jun 9, 2019
1 check passed
@n2ygk n2ygk deleted the openapi_unsorted_yaml branch Jun 9, 2019
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this issue Nov 17, 2020
* Add pyyaml.dump(..., sort_keys=False) to not sort openapi keys alphabetically
* Retain ordering of paths as provided in urlconf in OpenAPI schemas.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

4 participants