Skip to content

don't sort YAML keys #6680

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

Merged
merged 2 commits into from
Jun 9, 2019
Merged

Conversation

n2ygk
Copy link
Contributor

@n2ygk n2ygk commented May 15, 2019

Description

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?

@tomchristie
Copy link
Member

Oh that sounds like a neat one!

@carltongibson carltongibson added this to the 3.10 Release milestone May 16, 2019
@carltongibson carltongibson force-pushed the openapi_unsorted_yaml branch from 2df58da to 7d7912b Compare June 9, 2019 12:38
Copy link
Collaborator

@carltongibson carltongibson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, super yes. Thanks. 👍

@carltongibson carltongibson merged commit 4d22825 into encode:master Jun 9, 2019
@n2ygk n2ygk deleted the openapi_unsorted_yaml branch June 9, 2019 14:17
pchiquet pushed a commit to pchiquet/django-rest-framework that referenced this pull request 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.
sigvef pushed a commit to sigvef/django-rest-framework that referenced this pull request Dec 3, 2022
* 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants