Skip to content

Set schema fields in order by default#387

Merged
greyli merged 1 commit intomainfrom
ordered-fields
Dec 24, 2022
Merged

Set schema fields in order by default#387
greyli merged 1 commit intomainfrom
ordered-fields

Conversation

@greyli
Copy link
Copy Markdown
Member

@greyli greyli commented Dec 24, 2022

When generating the spec file with the flask spec command, the output should be deterministic. This PR changes the default set class of Schema class to OrderedSet, so that the schema fields will be in order by default.

P.S. There is already a PR in marshmallow for this (marshmallow-code/marshmallow#1896). We can remove this change when that PR is merged and we pin marshmallow >= 4.0.

Checklist:

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code docstring.
  • Add Version changed or Version added note in any relevant docs and docstring.
  • Add an entry in CHANGES.md summarizing the change and linking to the issue and your username.
  • Run pytest and tox, no tests failed.

@greyli greyli merged commit 7aa0f87 into main Dec 24, 2022
@greyli greyli deleted the ordered-fields branch December 24, 2022 05:06
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.

Make field order generated by flask spec deterministic Spec output is non-deterministic

1 participant