Skip to content

Commit 2386601

Browse files
[GENERATE] Pydantic models from JSON Schema
1 parent ebe8233 commit 2386601

File tree

2 files changed

+34
-22
lines changed
  • generated/python/datadoc_model/datadoc_model

2 files changed

+34
-22
lines changed

generated/python/datadoc_model/datadoc_model/all_optional/model.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: metadata-container-json-schema.json
3-
# timestamp: 2025-09-03T08:11:07+00:00
3+
# timestamp: 2025-09-03T09:21:45+00:00
44

55
from __future__ import annotations
66

@@ -34,12 +34,23 @@ class DataSetState(str, Enum):
3434
OUTPUT_DATA = "OUTPUT_DATA"
3535

3636

37-
class UseRestriction(str, Enum):
37+
class UseRestrictionType(Enum):
3838
DELETION_ANONYMIZATION = "DELETION_ANONYMIZATION"
3939
PROCESS_LIMITATIONS = "PROCESS_LIMITATIONS"
4040
SECONDARY_USE_RESTRICTIONS = "SECONDARY_USE_RESTRICTIONS"
4141

4242

43+
class UseRestrictionItem(DatadocBaseModel):
44+
use_restriction: Optional[UseRestrictionType] = Field(
45+
None, description="Use restriction type", title="Use restriction type"
46+
)
47+
use_restriction_date: Optional[AwareDatetime] = Field(
48+
None,
49+
description="Use restriction date, eg. the date (deadline) for when data must be deleted/anonymised.",
50+
title="Use restriction date",
51+
)
52+
53+
4354
class CustomTypeForDatasetMetadatum(DatadocBaseModel):
4455
key: Optional[str] = Field(None, description="Custom type KEY", title="Key")
4556
value: Optional[Union[str, list, dict[str, Any]]] = Field(
@@ -192,13 +203,8 @@ class Dataset(DatadocBaseModel):
192203
description="Description of the data set's spatial coverage",
193204
title="Spatial coverage description",
194205
)
195-
use_restriction: Optional[UseRestriction] = Field(
196-
None, description="Data set use restriction", title="Use restriction"
197-
)
198-
use_restriction_date: Optional[AwareDatetime] = Field(
199-
None,
200-
description="Use restriction date, eg. the date (deadline) for when data must be deleted/anonymised.",
201-
title="Use restriction date",
206+
use_restriction: Optional[list[UseRestrictionItem]] = Field(
207+
None, description="Use restriction", title="Use restriction"
202208
)
203209
custom_type: Optional[list[CustomTypeForDatasetMetadatum]] = Field(
204210
None,
@@ -380,8 +386,8 @@ class DatadocMetadata(DatadocBaseModel):
380386
percentage_complete: Optional[int] = Field(
381387
None, description="Percentage of obligatory metadata fields populated."
382388
)
383-
document_version: Literal["6.0.0"] = Field(
384-
"6.0.0", description="Version of this model"
389+
document_version: Literal["6.0.1"] = Field(
390+
"6.0.1", description="Version of this model"
385391
)
386392
dataset: Optional[Dataset] = None
387393
variables: Optional[list[Variable]] = None

generated/python/datadoc_model/datadoc_model/required/model.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# generated by datamodel-codegen:
22
# filename: metadata-container-json-schema.json
3-
# timestamp: 2025-09-03T08:11:09+00:00
3+
# timestamp: 2025-09-03T09:21:47+00:00
44

55
from __future__ import annotations
66

@@ -34,12 +34,23 @@ class DataSetState(str, Enum):
3434
OUTPUT_DATA = "OUTPUT_DATA"
3535

3636

37-
class UseRestriction(str, Enum):
37+
class UseRestrictionType(Enum):
3838
DELETION_ANONYMIZATION = "DELETION_ANONYMIZATION"
3939
PROCESS_LIMITATIONS = "PROCESS_LIMITATIONS"
4040
SECONDARY_USE_RESTRICTIONS = "SECONDARY_USE_RESTRICTIONS"
4141

4242

43+
class UseRestrictionItem(DatadocBaseModel):
44+
use_restriction: Optional[UseRestrictionType] = Field(
45+
None, description="Use restriction type", title="Use restriction type"
46+
)
47+
use_restriction_date: Optional[AwareDatetime] = Field(
48+
None,
49+
description="Use restriction date, eg. the date (deadline) for when data must be deleted/anonymised.",
50+
title="Use restriction date",
51+
)
52+
53+
4354
class CustomTypeForDatasetMetadatum(DatadocBaseModel):
4455
key: Optional[str] = Field(None, description="Custom type KEY", title="Key")
4556
value: Optional[Union[str, list, dict[str, Any]]] = Field(
@@ -186,13 +197,8 @@ class Dataset(DatadocBaseModel):
186197
description="Description of the data set's spatial coverage",
187198
title="Spatial coverage description",
188199
)
189-
use_restriction: Optional[UseRestriction] = Field(
190-
None, description="Data set use restriction", title="Use restriction"
191-
)
192-
use_restriction_date: Optional[AwareDatetime] = Field(
193-
None,
194-
description="Use restriction date, eg. the date (deadline) for when data must be deleted/anonymised.",
195-
title="Use restriction date",
200+
use_restriction: Optional[list[UseRestrictionItem]] = Field(
201+
None, description="Use restriction", title="Use restriction"
196202
)
197203
custom_type: Optional[list[CustomTypeForDatasetMetadatum]] = Field(
198204
None,
@@ -372,8 +378,8 @@ class DatadocMetadata(DatadocBaseModel):
372378
percentage_complete: Optional[int] = Field(
373379
None, description="Percentage of obligatory metadata fields populated."
374380
)
375-
document_version: Literal["6.0.0"] = Field(
376-
"6.0.0", description="Version of this model"
381+
document_version: Literal["6.0.1"] = Field(
382+
"6.0.1", description="Version of this model"
377383
)
378384
dataset: Dataset
379385
variables: list[Variable]

0 commit comments

Comments
 (0)