Make parameters order stable for multi-parameter URLs (#106)

Fixes #105

* Added intermittently failing test for #105
* Make parameter order stable for urls with multiple params
This commit is contained in:
John Carter authored and Cristi Vîjdea committed 2018-04-23 19:16:22 +03:00
1 parent 6dd8ded05d
commit 322971f3e7
5 files changed
+41 -1

No files matched your search

+1 -1
View File
@@ -403,7 +403,7 @@ class OpenAPISchemaGenerator(object):
queryset = getattr(view_cls, 'queryset', None)
model = getattr(getattr(view_cls, 'queryset', None), 'model', None)
for variable in uritemplate.variables(path):
for variable in sorted(uritemplate.variables(path)):
model, model_field = get_queryset_field(queryset, variable)
attrs = get_basic_type_info(model_field) or {'type': openapi.TYPE_STRING}
if getattr(view_cls, 'lookup_field', None) == variable and attrs['type'] == openapi.TYPE_STRING: