-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Forbid extra fields in Pydantic models (#43)
* Forbid extra fields * Add a test for unknown field * Release v4.3.0 * [GENERATE] Pydantic models from JSON Schema --------- Co-authored-by: dapla-bot[bot] <143391972+dapla-bot[bot]@users.noreply.github.com>
- Loading branch information
1 parent
15f70cd
commit 61f25c2
Showing
4 changed files
with
13 additions
and
4 deletions.
There are no files selected for viewing
6 changes: 4 additions & 2 deletions
6
generated/python/datadoc_model/datadoc_model/datadoc_base_model.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
from pydantic import ConfigDict, BaseModel | ||
from pydantic import BaseModel, ConfigDict | ||
|
||
|
||
class DatadocBaseModel(BaseModel): | ||
"""Defines configuration which applies to all Models in this package.""" | ||
|
||
model_config = ConfigDict(validate_assignment=True, use_enum_values=True) | ||
model_config = ConfigDict( | ||
validate_assignment=True, use_enum_values=True, extra="forbid" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "ssb-datadoc-model" | ||
version = "4.2.0" | ||
version = "4.3.0" | ||
description = "Data Model for use in Statistics Norway's Metadata system" | ||
authors = ["Statistics Norway <[email protected]>"] | ||
license = "MIT" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters