From c33c21c3c43dbd0c4b8599aed446530305f32cf7 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:04:43 +0100 Subject: [PATCH 01/14] Change type of owner field to string --- src/datadoc/datadoc-json-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index 084dbca..5ce0ec7 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -127,7 +127,7 @@ "owner": { "title": "Owner", "description": "Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83", - "$ref": "./no/languageStringType.json#/languageStringType" + "$ref": "string" }, "file_path": { "title": "File path", From 7ece5d562ae3d79f57c63e6b93fd120768184786 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:11:02 +0100 Subject: [PATCH 02/14] Include http extra for datamodel-codegen --- .github/workflows/generate-python.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-python.yml b/.github/workflows/generate-python.yml index e75b08d..d1d09f3 100644 --- a/.github/workflows/generate-python.yml +++ b/.github/workflows/generate-python.yml @@ -45,7 +45,7 @@ jobs: - name: Install datamodel-codegen run: | - python -m pipx install datamodel-code-generator==0.25.2 + python -m pipx install datamodel-code-generator[http]==0.25.2 - name: Generate Python run: > From bea54a8edd9a03b9250d6a362a69a58f8ff9119e Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:13:01 +0100 Subject: [PATCH 03/14] Correct to type --- .github/workflows/generate-python.yml | 2 +- src/datadoc/datadoc-json-schema.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/generate-python.yml b/.github/workflows/generate-python.yml index d1d09f3..e75b08d 100644 --- a/.github/workflows/generate-python.yml +++ b/.github/workflows/generate-python.yml @@ -45,7 +45,7 @@ jobs: - name: Install datamodel-codegen run: | - python -m pipx install datamodel-code-generator[http]==0.25.2 + python -m pipx install datamodel-code-generator==0.25.2 - name: Generate Python run: > diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index 5ce0ec7..740bc83 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -127,7 +127,7 @@ "owner": { "title": "Owner", "description": "Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83", - "$ref": "string" + "type": "string" }, "file_path": { "title": "File path", From 61898acbbce77ec9ec2cc5a879b3bcc9a57a897f Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 10:13:48 +0000 Subject: [PATCH 04/14] [GENERATE] Java classes from JSON Schema --- .../ssb/dapla/metadata/datadoc/Dataset.java | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java index e3e3f6f..f307a8b 100644 --- a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java +++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java @@ -212,14 +212,16 @@ public class Dataset implements Serializable @NotNull private UUID id; /** - * Reusable langugage string type + * Owner + *

+ * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ @JsonProperty("owner") - @Valid + @JsonPropertyDescription("Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83") @NotNull - private LanguageStringType owner; + private String owner; /** * File path *

@@ -296,7 +298,7 @@ public class Dataset implements Serializable @JsonIgnore @Valid private Map additionalProperties = new LinkedHashMap(); - private final static long serialVersionUID = 8856456406912570855L; + private final static long serialVersionUID = -7758597202153354155L; /** * No args constructor for use in serialization @@ -358,7 +360,7 @@ public Dataset() { * @param dataSource * Data source. Data source. Set either for the data set or instance variable. */ - public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, LanguageStringType owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public Dataset(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { super(); this.shortName = shortName; this.assessment = assessment; @@ -752,22 +754,26 @@ public void setId(UUID id) { } /** - * Reusable langugage string type + * Owner + *

+ * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ @JsonProperty("owner") - public LanguageStringType getOwner() { + public String getOwner() { return owner; } /** - * Reusable langugage string type + * Owner + *

+ * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ @JsonProperty("owner") - public void setOwner(LanguageStringType owner) { + public void setOwner(String owner) { this.owner = owner; } @@ -1162,7 +1168,7 @@ public DatasetBuilder() { super(); } - public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, LanguageStringType owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public DatasetBuilder(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { super(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, registerUri, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil); } @@ -1181,7 +1187,7 @@ public DatasetBuilderBase() { } @SuppressWarnings("unchecked") - public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, LanguageStringType owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { + public DatasetBuilderBase(String shortName, Dataset.Assessment assessment, Dataset.DataSetStatus datasetStatus, Dataset.DataSetState datasetState, LanguageStringType name, LanguageStringType description, LanguageStringType dataSource, LanguageStringType registerUri, LanguageStringType populationDescription, String version, LanguageStringType versionDescription, String unitType, Dataset.TemporalityTypeType temporalityType, LanguageStringType subjectField, List keyword, LanguageStringType spatialCoverageDescription, UUID id, String owner, String filePath, Date metadataCreatedDate, String metadataCreatedBy, Date metadataLastUpdatedDate, String metadataLastUpdatedBy, String containsDataFrom, String containsDataUntil) { // Skip initialization when called from subclass if (this.getClass().equals(Dataset.DatasetBuilder.class)) { this.instance = ((T) new Dataset(shortName, assessment, datasetStatus, datasetState, name, description, dataSource, registerUri, populationDescription, version, versionDescription, unitType, temporalityType, subjectField, keyword, spatialCoverageDescription, id, owner, filePath, metadataCreatedDate, metadataCreatedBy, metadataLastUpdatedDate, metadataLastUpdatedBy, containsDataFrom, containsDataUntil)); @@ -1280,7 +1286,7 @@ public Dataset.DatasetBuilderBase withId(UUID id) { return this; } - public Dataset.DatasetBuilderBase withOwner(LanguageStringType owner) { + public Dataset.DatasetBuilderBase withOwner(String owner) { ((Dataset) this.instance).owner = owner; return this; } From eaea01d152781f208f9aba0cdfa0f20e9be11d92 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 10:14:19 +0000 Subject: [PATCH 05/14] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index 45244c8..8fd0d1c 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-02-21T08:51:44+00:00 +# timestamp: 2024-03-06T10:14:19+00:00 from __future__ import annotations @@ -212,7 +212,7 @@ class Dataset(DatadocBaseModel): id: Optional[UUID] = Field( None, description="Unique identifier for the data set", title="Identifier" ) - owner: Optional[LanguageStringType] = Field( + owner: Optional[str] = Field( None, description="Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83", title="Owner", From 52f2ceaa35744192b63a9f66bb922190041e2390 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:13:24 +0100 Subject: [PATCH 06/14] Update description of owner field --- src/datadoc/datadoc-json-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index 740bc83..a622ac2 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -126,7 +126,7 @@ }, "owner": { "title": "Owner", - "description": "Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83", + "description": "Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83", "type": "string" }, "file_path": { From c6bb10a049de4226323615a0e1e195f577b28e24 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:13:56 +0000 Subject: [PATCH 07/14] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index 8fd0d1c..e55423d 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-03-06T10:14:19+00:00 +# timestamp: 2024-03-06T11:13:56+00:00 from __future__ import annotations @@ -214,7 +214,7 @@ class Dataset(DatadocBaseModel): ) owner: Optional[str] = Field( None, - description="Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83", + description="Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83", title="Owner", ) file_path: Optional[str] = Field( From d9abb08ff490bce779221644cdcfadcfed1af2bb Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Wed, 6 Mar 2024 11:14:39 +0000 Subject: [PATCH 08/14] [GENERATE] Java classes from JSON Schema --- .../java/no/ssb/dapla/metadata/datadoc/Dataset.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java index f307a8b..2879f30 100644 --- a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java +++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/Dataset.java @@ -214,12 +214,12 @@ public class Dataset implements Serializable /** * Owner *

- * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 + * Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ @JsonProperty("owner") - @JsonPropertyDescription("Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83") + @JsonPropertyDescription("Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83") @NotNull private String owner; /** @@ -342,7 +342,7 @@ public Dataset() { * @param keyword * Keyword(s). A list of searchable keywords that can contribute to the development of effective filtering and search services. * @param owner - * Owner. Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83. + * Owner. Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83. * @param containsDataFrom * Contains data from. The data set contains data from date/time. * @param filePath @@ -756,7 +756,7 @@ public void setId(UUID id) { /** * Owner *

- * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 + * Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ @@ -768,7 +768,7 @@ public String getOwner() { /** * Owner *

- * Owner of the data set (responsible division in Statistics Norway). See also Classification of organisational units https://www.ssb.no/en/klass/klassifikasjoner/83 + * Owner of the data set (responsible division in Statistics Norway). Values defined by https://www.ssb.no/en/klass/klassifikasjoner/83 * (Required) * */ From 835acba0f2f355027c839776a680dd0230ec9781 Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:16:21 +0100 Subject: [PATCH 09/14] Release v4.3.0 --- generated/python/datadoc_model/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/python/datadoc_model/pyproject.toml b/generated/python/datadoc_model/pyproject.toml index aa4ba94..09f1833 100644 --- a/generated/python/datadoc_model/pyproject.toml +++ b/generated/python/datadoc_model/pyproject.toml @@ -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 "] license = "MIT" From ba25e7b147b8ff113663de9b047522fd47b0a80d Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:29:57 +0100 Subject: [PATCH 10/14] Add trigger to release --- .github/workflows/release-python.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-python.yml b/.github/workflows/release-python.yml index 483f773..c68b66f 100644 --- a/.github/workflows/release-python.yml +++ b/.github/workflows/release-python.yml @@ -5,6 +5,7 @@ on: branches: - main - master + - backport/** paths: - "generated/python/**" - ".github/workflows/release-python.yml" From 6698d2ed9392f277bf8f76c43be2be511f8465ab Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Wed, 6 Mar 2024 12:32:48 +0100 Subject: [PATCH 11/14] Release v4.3.1 --- generated/python/datadoc_model/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/python/datadoc_model/pyproject.toml b/generated/python/datadoc_model/pyproject.toml index 09f1833..4754809 100644 --- a/generated/python/datadoc_model/pyproject.toml +++ b/generated/python/datadoc_model/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ssb-datadoc-model" -version = "4.3.0" +version = "4.3.1" description = "Data Model for use in Statistics Norway's Metadata system" authors = ["Statistics Norway "] license = "MIT" From 52d8e016e885f8e46dd389d54cd11e147d7a4f2c Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:35:04 +0100 Subject: [PATCH 12/14] Bump datadoc document version --- src/datadoc/datadoc-json-schema.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/datadoc/datadoc-json-schema.json b/src/datadoc/datadoc-json-schema.json index a622ac2..371fa80 100644 --- a/src/datadoc/datadoc-json-schema.json +++ b/src/datadoc/datadoc-json-schema.json @@ -10,7 +10,7 @@ }, "document_version": { "description": "Version of this model", - "const": "2.1.0" + "const": "2.2.0" }, "dataset": { "type": "object", From 9d504b6a509ce6d541045667a48ad87f57a11090 Mon Sep 17 00:00:00 2001 From: "dapla-bot[bot]" <143391972+dapla-bot[bot]@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:35:44 +0000 Subject: [PATCH 13/14] [GENERATE] Pydantic models from JSON Schema --- generated/python/datadoc_model/datadoc_model/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/generated/python/datadoc_model/datadoc_model/model.py b/generated/python/datadoc_model/datadoc_model/model.py index e55423d..371ef7d 100644 --- a/generated/python/datadoc_model/datadoc_model/model.py +++ b/generated/python/datadoc_model/datadoc_model/model.py @@ -1,6 +1,6 @@ # generated by datamodel-codegen: # filename: metadata-container-json-schema.json -# timestamp: 2024-03-06T11:13:56+00:00 +# timestamp: 2024-03-08T11:35:44+00:00 from __future__ import annotations @@ -345,8 +345,8 @@ class DatadocMetadata(DatadocBaseModel): percentage_complete: Optional[int] = Field( None, description="Percentage of obligatory metadata fields populated." ) - document_version: Literal["2.1.0"] = Field( - "2.1.0", description="Version of this model" + document_version: Literal["2.2.0"] = Field( + "2.2.0", description="Version of this model" ) dataset: Optional[Dataset] = None variables: Optional[list[Variable]] = None From a5f50381612dbee1b3b171a16d83ca4a27d5c2df Mon Sep 17 00:00:00 2001 From: Miles Mason Winther <42948872+mmwinther@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:37:31 +0100 Subject: [PATCH 14/14] Release v4.3.2 --- generated/python/datadoc_model/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generated/python/datadoc_model/pyproject.toml b/generated/python/datadoc_model/pyproject.toml index 4754809..3fa7f21 100644 --- a/generated/python/datadoc_model/pyproject.toml +++ b/generated/python/datadoc_model/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ssb-datadoc-model" -version = "4.3.1" +version = "4.3.2" description = "Data Model for use in Statistics Norway's Metadata system" authors = ["Statistics Norway "] license = "MIT"