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

CLN: Switch to pydantic for access field in metadata class #539

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

tnatt
Copy link
Collaborator

@tnatt tnatt commented Mar 19, 2024

PR to replace the generate_meta_access function inside _metadata with the pydantic Access model instead.

The logic inside this function has been replaced by pydantic, and will upon entering here already has been through the validation. Since we still allow an invalid config (pure object export), the current implementation did only run this function when finding a truthy _config_is_valid flag.

Comment on lines -155 to -166
exclude_defaults=True,
exclude_none=True,
exclude_unset=True,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping defaults and unset fields is not desired behavior, and lead to unwanted effects further in the execution. This is removed.

@tnatt tnatt force-pushed the use_pydantic_metadata_access branch from f13eaee to ef37bf7 Compare March 19, 2024 13:43
return config["masterdata"]


def generate_meta_access(config: dict) -> dict | None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So happy to see this!

@tnatt tnatt merged commit e2fd923 into equinor:main Mar 19, 2024
13 checks passed
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