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

Use custom Base Model #36

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Changes from 1 commit
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
Next Next commit
Use custom Base Model
This allows us to set config to control Pydantic behaviour.
mmwinther committed Jan 5, 2024

Verified

This commit was signed with the committer’s verified signature.
lkysow Luke Kysow
commit 060aa6b2b917957c925410819e06e91098bc22f1
1 change: 1 addition & 0 deletions .github/workflows/generate-python.yml
Original file line number Diff line number Diff line change
@@ -53,6 +53,7 @@ jobs:
--input-file-type jsonschema
--input src/metadata-container-json-schema.json
--output-model-type pydantic_v2.BaseModel
--base-class "datadoc_model.datadoc_base_model.DatadocBaseModel"
--use-default
--use-one-literal-as-default
--force-optional
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from pydantic import ConfigDict, BaseModel


class DatadocBaseModel(BaseModel):
"""Defines configuration which applies to all Models in this package."""

model_config = ConfigDict(validate_assignment=True, use_enum_values=True)