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

Schema Definitions Are Not Deterministically Ordered #116

Closed
dagrooms52 opened this issue Aug 15, 2018 · 1 comment
Closed

Schema Definitions Are Not Deterministically Ordered #116

dagrooms52 opened this issue Aug 15, 2018 · 1 comment

Comments

@dagrooms52
Copy link

dagrooms52 commented Aug 15, 2018

Background
I am generating a Flask server from a Swagger document with multiple schema definitions. I am generating the server code at build time, and committing it in source control.

Actual Outcome
Between two builds with no changes in my swagger.yaml, the file schemas.py moves a Definitions... entry between two different lines in the file; it is either the first Definitions entry, or the third. This is seen in the diff:

$ git diff
-DefinitionsWeirdType = {'type': 'object', 'blah': 'blah'}  # Hops from here..
DefinitionsOkType = {'type': 'object', 'blah': 'blah'}
DefinitionsFineType = {'type': 'object', 'blah': 'blah'}
+DefinitionsWeirdType = {'type': 'object', 'blah': 'blah'}  # To here

Expected Outcome
The file should not change between two builds. The Definitions variables should be sorted in a deterministic manner.

Versions

Python 3.6.5
swagger-py-codegen==0.3.2
swagger: "2.0"

Additional Details
I can work around this for now by only running my swagger-py-codegen task if changes are detected in my swagger.yaml.

@foodszhang
Copy link
Contributor

@dagrooms52 Could you provide your swagger.yaml or a yaml that can stably reproduce this problem?

This was referenced Aug 24, 2018
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

No branches or pull requests

2 participants