From bec2ccb5efc1c153e3cb62436b38135ba14dee0d Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Thu, 22 Feb 2024 09:12:35 +0000 Subject: [PATCH] [GENERATE] Pydantic models from JSON Schema --- .../datadoc_model/datadoc_model/model.py | 41 +++++++++---------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index eca1650..9af6d4e 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,10 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -<<<<<<< HEAD -# timestamp: 2024-02-12T16:12:27+00:00 -======= -# timestamp: 2024-02-21T09:13:37+00:00 ->>>>>>> origin/main +# timestamp: 2024-02-22T09:12:35+00:00 from __future__ import annotations @@ -44,7 +40,7 @@ class UseRestriction(str, Enum): SECONDARY_USE_RESTRICTIONS = "SECONDARY_USE_RESTRICTIONS" -class CustomTypeItem(DatadocBaseModel): +class CustomTypeForDatasetMetadatum(DatadocBaseModel): key: Optional[str] = Field(None, description="Custom type KEY", title="Key") value: Optional[Union[str, list, dict[str, Any]]] = Field( None, @@ -70,7 +66,7 @@ class VariableRole(str, Enum): ATTRIBUTE = "ATTRIBUTE" -class Sentinel(DatadocBaseModel): +class SentinelValues(DatadocBaseModel): sentinel_value_uri: Optional[AnyUrl] = Field( None, description="A link (URI) to a standardized list of sentinel values included in the variable, eg. a link to a codelist in Klass (https://www.ssb.no/en/klass/)", @@ -83,7 +79,15 @@ class Sentinel(DatadocBaseModel): ) -<<<<<<< HEAD +class CustomTypeForVariableMetadatum(DatadocBaseModel): + key: Optional[str] = Field(None, description="Custom type KEY", title="Key") + value: Optional[Union[str, list, dict[str, Any]]] = Field( + None, + description="Custom type VALUE (of type string, array or object).", + title="Value", + ) + + class LanguageStringTypeItem(DatadocBaseModel): languageCode: Optional[str] = Field( None, description="Language code (ISO 639-1)", title="Language code" @@ -97,8 +101,6 @@ class LanguageStringType(RootModel[Optional[list[LanguageStringTypeItem]]]): root: Optional[list[LanguageStringTypeItem]] = None -======= ->>>>>>> origin/main class TemporalityTypeType(str, Enum): FIXED = "FIXED" STATUS = "STATUS" @@ -262,7 +264,7 @@ class Dataset(DatadocBaseModel): description="Use restriction date, eg. the date (deadline) for when data must be deleted/anonymised.", title="Use restriction date", ) - custom_type: Optional[list[CustomTypeItem]] = Field( + custom_type: Optional[list[CustomTypeForDatasetMetadatum]] = Field( None, description="Extend the DataDoc model by adding custom metadata elements as key-value-pairs (string, array or objects).", title="Custom type for dataset metadata", @@ -310,7 +312,7 @@ class Dataset(DatadocBaseModel): ) -class OtherValueItem(DatadocBaseModel): +class OtherSpecialValue(DatadocBaseModel): code: Optional[str] = Field(None, description="Other value code", title="Code") name: Optional[LanguageStringType] = Field( None, description="Other value name (text)", title="Name" @@ -323,9 +325,9 @@ class OtherValueItem(DatadocBaseModel): ) -class SpecialValue(DatadocBaseModel): - sentinel: Optional[Sentinel] = Field(None, title="Sentinel values") - other_value: Optional[list[OtherValueItem]] = Field( +class SpecialValues(DatadocBaseModel): + sentinel: Optional[SentinelValues] = Field(None, title="Sentinel values") + other_value: Optional[list[OtherSpecialValue]] = Field( None, description="Other special values not represented as 'sentinel_value' in a standardized code list.", title="Other special values", @@ -404,13 +406,13 @@ class Variable(DatadocBaseModel): description="Link (URI) to valid classification or code list", title="Classification or codelist URI", ) - special_value: Optional[SpecialValue] = Field(None, title="Special values") + special_value: Optional[SpecialValues] = Field(None, title="Special values") invalid_value_description: Optional[LanguageStringType] = Field( None, description="Invalid value(s) description used in addition (or as an alternative) to standard sentinel values.", title="Invalid value(s) description", ) - custom_type: Optional[list[CustomTypeItem]] = Field( + custom_type: Optional[list[CustomTypeForVariableMetadatum]] = Field( None, description="Extend the DataDoc model by adding custom metadata elements as key-value-pairs (string, array or objects).", title="Custom type for variable metadata", @@ -436,13 +438,8 @@ class DatadocMetadata(DatadocBaseModel): percentage_complete: Optional[int] = Field( None, description="Percentage of obligatory metadata fields populated." ) -<<<<<<< HEAD document_version: Literal["3.0.0"] = Field( "3.0.0", description="Version of this model" -======= - document_version: Literal["2.1.0"] = Field( - "2.1.0", description="Version of this model" ->>>>>>> origin/main ) dataset: Optional[Dataset] = None variables: Optional[list[Variable]] = None