From c975a1b554bf9fc4a4409e73b58a7c1153f7c3d7 Mon Sep 17 00:00:00 2001 From: Alan Crosswell Date: Wed, 15 May 2019 16:55:47 -0500 Subject: [PATCH 1/2] add pyyaml.dump(..., sort_keys=False) to not sort openapi keys alphabetically --- requirements/requirements-optionals.txt | 2 +- rest_framework/renderers.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/requirements-optionals.txt b/requirements/requirements-optionals.txt index d38ede9bab..c5be70c3d5 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 3dc94ed2d3..772ef3c2ca 100644 --- a/rest_framework/renderers.py +++ b/rest_framework/renderers.py @@ -1049,7 +1049,7 @@ def __init__(self): 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): From 7d7912b7697791e1239347329dc7a5efb92f62d6 Mon Sep 17 00:00:00 2001 From: Alan Crosswell Date: Thu, 16 May 2019 11:52:00 -0500 Subject: [PATCH 2/2] Retain ordering of paths as provided in urlconf in OpenAPI schemas. --- docs/community/release-notes.md | 2 ++ rest_framework/schemas/generators.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/community/release-notes.md b/docs/community/release-notes.md index a27de2b641..d532c2ba70 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] @@ -2137,4 +2138,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/rest_framework/schemas/generators.py b/rest_framework/schemas/generators.py index 392d385d8d..c80ace7d37 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( pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy