diff --git a/docs/community/release-notes.md b/docs/community/release-notes.md index 0f88adfc3..235447eee 100644 --- a/docs/community/release-notes.md +++ b/docs/community/release-notes.md @@ -44,6 +44,7 @@ You can determine your currently installed version using `pip show`: **Date**: [Unreleased][3.10.0-milestone] +* Updated PyYaml dependency for OpenAPI schema generation to `pyyaml>=5.1` [#6680][gh6680] * Resolve DeprecationWarning with markdown. [#6317][gh6317] * Add `generateschema --generator_class` CLI option @@ -2138,4 +2139,5 @@ For older release notes, [please see the version 2.x documentation][old-release- [gh6613]: https://github.com/encode/django-rest-framework/issues/6613 +[gh6680]: https://github.com/encode/django-rest-framework/issues/6680 [gh6317]: https://github.com/encode/django-rest-framework/issues/6317 diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index d38ede9ba..c5be70c3d 100644 --- a/requirements/requirements-optionals.txt +++ b/requirements/requirements-optionals.txt @@ -6,4 +6,4 @@ django-guardian==1.5.0 django-filter>=2.1.0, <2.2 coreapi==2.3.1 coreschema==0.0.4 -pyyaml +pyyaml>=5.1 diff --git a/rest_framework/renderers.py b/rest_framework/renderers.py index 3dc94ed2d..772ef3c2c 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -1049,7 +1049,7 @@ class OpenAPIRenderer(BaseRenderer): assert yaml, 'Using OpenAPIRenderer, but `pyyaml` is not installed.' def render(self, data, media_type=None, renderer_context=None): - return yaml.dump(data, default_flow_style=False).encode('utf-8') + return yaml.dump(data, default_flow_style=False, sort_keys=False).encode('utf-8') class JSONOpenAPIRenderer(BaseRenderer): diff --git a/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index 392d385d8..c80ace7d3 100644 --- a/rest_framework/schemas/generators.py +++ b/rest_framework/schemas/generators.py @@ -54,7 +54,7 @@ def endpoint_ordering(endpoint): 'PATCH': 3, 'DELETE': 4 }.get(method, 5) - return (path, method_priority) + return (method_priority,) _PATH_PARAMETER_COMPONENT_RE = re.compile(