Skip to content

Python: Generate model with required fields also#55

Merged
mmwinther merged 9 commits intomainfrom
dpmeta-863-generate-model-with-required-fields-also
May 5, 2025
Merged

Python: Generate model with required fields also#55
mmwinther merged 9 commits intomainfrom
dpmeta-863-generate-model-with-required-fields-also

Conversation

@mmwinther
Copy link
Member

@mmwinther mmwinther commented May 5, 2025

The existing model used the --force-optional flag to make every field optional to support validation of user input. This is however less useful for validation of complete models. This change generates two variants of the model to named subpackages, all_optional and required. To avoid breaking existing inputs, we create a backwards compatibility shim module in <generated/datadoc_model/datadoc_model/model.py> which supports existing imports on datadoc_model.model and raises a DeprecationWarning.

The command for generating the Python models is moved to a shell script for modularity.

@mmwinther mmwinther requested review from a team and BjornRoarJoneid as code owners May 5, 2025 08:44
@github-actions github-actions bot added ci Continuous Integration python Updates to the generated Python project labels May 5, 2025
Copy link
Contributor

@tilen1976 tilen1976 left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@mmwinther mmwinther merged commit 7914e06 into main May 5, 2025
7 of 8 checks passed
@mmwinther mmwinther deleted the dpmeta-863-generate-model-with-required-fields-also branch May 5, 2025 11:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continuous Integration python Updates to the generated Python project

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants