Skip to content

Commit

Permalink
[GENERATE] Pydantic models from JSON Schema
Browse files Browse the repository at this point in the history
  • Loading branch information
dapla-bot[bot] committed Feb 22, 2024
1 parent 0614071 commit bec2ccb
Showing 1 changed file with 19 additions and 22 deletions.
41 changes: 19 additions & 22 deletions generated/python/datadoc_model/datadoc_model/model.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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/)",
Expand All @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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"
Expand All @@ -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",
Expand Down Expand Up @@ -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",
Expand All @@ -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
Expand Down

0 comments on commit bec2ccb

Please sign in to comment.