Skip to content

Preserve order of default keys #527

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions voluptuous/schema_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,12 @@ def _compile_mapping(self, schema, invalid_msg=None):
)

# Keys that may have defaults
all_default_keys = set(
key
for key in schema
if isinstance(key, Required) or isinstance(key, Optional)
all_default_keys = tuple(
{
key: None
for key in schema
if isinstance(key, Required) or isinstance(key, Optional)
}.keys()
)

_compiled_schema = {}
Expand Down
Loading