Skip to content
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

Adding schema key sorting #6

Closed
wants to merge 1 commit into from

Conversation

MissiaL
Copy link
Contributor

@MissiaL MissiaL commented Mar 11, 2020

In my case, the schema in swagger-ui display looks unsorted. This is inconvenient to use.
image
This is a problem for schema users.

If sorted, then everything looks good and it’s convenient to use
image

@tfranzel
Copy link
Owner

Thanks again for contributing! I hope drf-spectacular will be a great help with your large project. Since this is a pretty new project i haven't gotten around writing a CONTRIBUTING file (which i will when i have some time).

It is a lot easier for me to understand the PR, if you summarize what the issue is and why it needs changing. Sometimes it's obvious, sometimes it's not.

In this case I don't really get what your intent is. could you elaborate?

looking at the generated specs, they really look scrambled with sorting. like the openapi: 3.0.3 landing somewhere in the center of the spec. to me that looks just really unexpected. if we were to add this, it would need to be achieved differently.

do you have issues with a non-deterministic spec? afaik the spec should always be deterministic when python>=3.6 is used (https://stackoverflow.com/a/14959001/2399008). I also made >=3.6 a requirement because of the type hinting introduced there.

@MissiaL
Copy link
Contributor Author

MissiaL commented Mar 12, 2020

Sorry for the lack of description. I described the problems in more detail.

@tfranzel
Copy link
Owner

ahh now i get your problem. i noticed that too but it did not bother me that much yet. i have an idea how to fix that without scrambling the schema. let me get back at you.

@tfranzel
Copy link
Owner

added alphanumeric then method sorting as default without scrambling the schema. close the PR if that works as expected.

@MissiaL
Copy link
Contributor Author

MissiaL commented Mar 13, 2020

Working! Thanks!

@MissiaL MissiaL closed this Mar 13, 2020
@MissiaL MissiaL deleted the schema-sorting branch March 13, 2020 07:14
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.

2 participants