Sort paths in output

openapi3
Cristi Vîjdea 2017-12-06 10:46:27 +01:00
parent 3f428d0cd1
commit 82cac4ef0d
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
from collections import defaultdict from collections import defaultdict, OrderedDict
import django.db.models import django.db.models
import uritemplate import uritemplate
@ -57,9 +57,9 @@ class OpenAPISchemaGenerator(object):
if not self.endpoints: if not self.endpoints:
return [] return []
prefix = self._gen.determine_path_prefix(self.endpoints.keys()) prefix = self._gen.determine_path_prefix(self.endpoints.keys())
paths = {} paths = OrderedDict()
for path, (view_cls, methods) in self.endpoints.items(): for path, (view_cls, methods) in sorted(self.endpoints.items()):
path_parameters = self.get_path_parameters(path, view_cls) path_parameters = self.get_path_parameters(path, view_cls)
operations = {} operations = {}
for method, view in methods: for method, view in methods: