diff --git a/.github/workflows/generate-java.yml b/.github/workflows/generate-java.yml
index 26786a31..da48f7d2 100644
--- a/.github/workflows/generate-java.yml
+++ b/.github/workflows/generate-java.yml
@@ -1,13 +1,14 @@
+name: Generate Java
on:
push:
branches:
- - "**"
- - "!main"
+ - "**"
+ - "!main"
paths:
- - "src/**"
- - "generated/java/datadoc-model/pom.xml"
- - ".github/workflows/generate-java.yml"
+ - "src/**"
+ - "generated/java/datadoc-model/pom.xml"
+ - ".github/workflows/generate-java.yml"
# Allow only one generate workflow to run at a time. This avoids race conditions when
# pushing to the same branch.
@@ -38,10 +39,10 @@ jobs:
- name: Generate Java
run: |
- pushd generated/java/datadoc-model
- rm -rf src/main/java
- ./mvnw jsonschema2pojo:generate
- popd
+ pushd generated/java/datadoc-model
+ rm -rf src/main/java
+ ./mvnw jsonschema2pojo:generate
+ popd
- name: Check for modified files
id: git-check
@@ -50,11 +51,11 @@ jobs:
- name: Commit
if: steps.git-check.outputs.modified == 'true'
run: |
- git add -A
- git commit -m '[GENERATE] Java classes from JSON Schema'
+ git add -A
+ git commit -m '[GENERATE] Java classes from JSON Schema'
- name: Push
if: steps.git-check.outputs.modified == 'true'
run: |
- git pull --rebase origin "${GITHUB_REF}"
- git push origin "${GITHUB_REF}"
+ git pull --rebase origin "${GITHUB_REF}"
+ git push origin "${GITHUB_REF}"
diff --git a/.github/workflows/generate-python.yml b/.github/workflows/generate-python.yml
index e75b08d4..a2896130 100644
--- a/.github/workflows/generate-python.yml
+++ b/.github/workflows/generate-python.yml
@@ -1,12 +1,13 @@
+name: Generate Python
on:
push:
branches:
- - "**"
- - "!main"
+ - "**"
+ - "!main"
paths:
- - "src/**/*.json"
- - ".github/workflows/generate-python.yml"
+ - "src/**/*.json"
+ - ".github/workflows/generate-python.yml"
# Allow only one generate workflow to run at a time. This avoids race conditions when
# pushing to the same branch.
@@ -40,29 +41,29 @@ jobs:
- name: Install pipx
run: |
- python -m pip install --upgrade pipx
- python -m pipx ensurepath
+ python -m pip install --upgrade pipx
+ python -m pipx ensurepath
- name: Install datamodel-codegen
run: |
- python -m pipx install datamodel-code-generator==0.25.2
+ python -m pipx install datamodel-code-generator==0.25.2
- name: Generate Python
run: >
- datamodel-codegen
- --input-file-type jsonschema
- --input src/metadata-container-json-schema.json
- --output-model-type pydantic_v2.BaseModel
- --base-class "datadoc_model.datadoc_base_model.DatadocBaseModel"
- --use-default
- --use-title-as-name
- --use-one-literal-as-default
- --force-optional
- --use-subclass-enum
- --use-standard-collections
- --use-double-quotes
- --target-python-version 3.10
- --output generated/python/datadoc_model/datadoc_model/model.py
+ datamodel-codegen
+ --input-file-type jsonschema
+ --input src/metadata-container-json-schema.json
+ --output-model-type pydantic_v2.BaseModel
+ --base-class "datadoc_model.datadoc_base_model.DatadocBaseModel"
+ --use-default
+ --use-title-as-name
+ --use-one-literal-as-default
+ --force-optional
+ --use-subclass-enum
+ --use-standard-collections
+ --use-double-quotes
+ --target-python-version 3.10
+ --output generated/python/datadoc_model/datadoc_model/model.py
- name: Check for modified files
id: git-check
@@ -71,11 +72,11 @@ jobs:
- name: Commit
if: steps.git-check.outputs.modified == 'true'
run: |
- git add -A
- git commit -m '[GENERATE] Pydantic models from JSON Schema'
+ git add -A
+ git commit -m '[GENERATE] Pydantic models from JSON Schema'
- name: Push
if: steps.git-check.outputs.modified == 'true'
run: |
- git pull --rebase origin "${GITHUB_REF}"
- git push origin "${GITHUB_REF}"
+ git pull --rebase origin "${GITHUB_REF}"
+ git push origin "${GITHUB_REF}"
diff --git a/generated/java/datadoc-model/pom.xml b/generated/java/datadoc-model/pom.xml
index 5366f2b0..58ad41f4 100644
--- a/generated/java/datadoc-model/pom.xml
+++ b/generated/java/datadoc-model/pom.xml
@@ -1,4 +1,6 @@
-
+
4.0.0
no.ssb.dapla.metadata
datadoc-model
@@ -13,7 +15,8 @@
${jdk.version}
UTF-8
UTF-8
- artifactregistry://europe-north1-maven.pkg.dev/artifact-registry-5n/dapla-stat-maven/
+
+ artifactregistry://europe-north1-maven.pkg.dev/artifact-registry-5n/dapla-stat-maven/
statisticsnorway/ssb-datadoc-model
@@ -35,66 +38,66 @@
- commons-lang
- commons-lang
- ${commons-lang.version}
+ commons-lang
+ commons-lang
+ ${commons-lang.version}
- com.fasterxml.jackson.core
- jackson-databind
- ${jackson-databind.version}
+ com.fasterxml.jackson.core
+ jackson-databind
+ ${jackson-databind.version}
- jakarta.validation
- jakarta.validation-api
- ${jakarta.validation-api.version}
+ jakarta.validation
+ jakarta.validation-api
+ ${jakarta.validation-api.version}
-
-
- org.apache.maven.plugins
- maven-release-plugin
- ${maven-release-plugin.version}
-
- java-v@{project.version}
-
-
-
- org.jsonschema2pojo
- jsonschema2pojo-maven-plugin
- ${jsonschema2pojo-maven-plugin.version}
-
- ${basedir}../../../../src
- ${basedir}/src/main/java
- no.ssb.dapla.metadata
- true
- true
- true
- true
- true
- true
- true
-
-
-
-
- generate
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- ${jdk.version}
-
-
-
+
+
+ org.apache.maven.plugins
+ maven-release-plugin
+ ${maven-release-plugin.version}
+
+ java-v@{project.version}
+
+
+
+ org.jsonschema2pojo
+ jsonschema2pojo-maven-plugin
+ ${jsonschema2pojo-maven-plugin.version}
+
+ ${basedir}../../../../src
+ ${basedir}/src/main/java
+ no.ssb.dapla.metadata
+ true
+ true
+ true
+ true
+ true
+ true
+ true
+
+
+
+
+ generate
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+
+
+ ${jdk.version}
+
+
+
@@ -104,7 +107,6 @@
${artifactregistry-maven-wagon.version}
-
@@ -158,4 +160,4 @@
-
+
\ No newline at end of file
diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType.java
new file mode 100644
index 00000000..592f0fa3
--- /dev/null
+++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType.java
@@ -0,0 +1,231 @@
+
+package no.ssb.dapla.metadata.datadoc;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyDescription;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import jakarta.validation.Valid;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "key",
+ "value"
+})
+@Generated("jsonschema2pojo")
+public class CustomType implements Serializable
+{
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ @JsonPropertyDescription("Custom type KEY")
+ private String key;
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ @JsonPropertyDescription("Custom type VALUE (of type string, array or object).")
+ private Object value;
+ @JsonIgnore
+ @Valid
+ private Map additionalProperties = new LinkedHashMap();
+ private final static long serialVersionUID = 5187573791864322508L;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public CustomType() {
+ }
+
+ /**
+ *
+ * @param value
+ * Value. Custom type VALUE (of type string, array or object).
+ * @param key
+ * Key. Custom type KEY.
+ */
+ public CustomType(String key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ public static CustomType.CustomTypeBuilderBase builder() {
+ return new CustomType.CustomTypeBuilder();
+ }
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(CustomType.class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("key");
+ sb.append('=');
+ sb.append(((this.key == null)?"":this.key));
+ sb.append(',');
+ sb.append("value");
+ sb.append('=');
+ sb.append(((this.value == null)?"":this.value));
+ sb.append(',');
+ sb.append("additionalProperties");
+ sb.append('=');
+ sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
+ result = ((result* 31)+((this.value == null)? 0 :this.value.hashCode()));
+ result = ((result* 31)+((this.key == null)? 0 :this.key.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof CustomType) == false) {
+ return false;
+ }
+ CustomType rhs = ((CustomType) other);
+ return ((((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))&&((this.value == rhs.value)||((this.value!= null)&&this.value.equals(rhs.value))))&&((this.key == rhs.key)||((this.key!= null)&&this.key.equals(rhs.key))));
+ }
+
+ public static class CustomTypeBuilder
+ extends CustomType.CustomTypeBuilderBase
+ {
+
+
+ public CustomTypeBuilder() {
+ super();
+ }
+
+ public CustomTypeBuilder(String key, Object value) {
+ super(key, value);
+ }
+
+ }
+
+ public static abstract class CustomTypeBuilderBase{
+
+ protected T instance;
+
+ @SuppressWarnings("unchecked")
+ public CustomTypeBuilderBase() {
+ // Skip initialization when called from subclass
+ if (this.getClass().equals(CustomType.CustomTypeBuilder.class)) {
+ this.instance = ((T) new CustomType());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public CustomTypeBuilderBase(String key, Object value) {
+ // Skip initialization when called from subclass
+ if (this.getClass().equals(CustomType.CustomTypeBuilder.class)) {
+ this.instance = ((T) new CustomType(key, value));
+ }
+ }
+
+ public T build() {
+ T result;
+ result = this.instance;
+ this.instance = null;
+ return result;
+ }
+
+ public CustomType.CustomTypeBuilderBase withKey(String key) {
+ ((CustomType) this.instance).key = key;
+ return this;
+ }
+
+ public CustomType.CustomTypeBuilderBase withValue(Object value) {
+ ((CustomType) this.instance).value = value;
+ return this;
+ }
+
+ public CustomType.CustomTypeBuilderBase withAdditionalProperty(String name, Object value) {
+ ((CustomType) this.instance).additionalProperties.put(name, value);
+ return this;
+ }
+
+ }
+
+}
diff --git a/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType__1.java b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType__1.java
new file mode 100644
index 00000000..18c92d6d
--- /dev/null
+++ b/generated/java/datadoc-model/src/main/java/no/ssb/dapla/metadata/datadoc/CustomType__1.java
@@ -0,0 +1,231 @@
+
+package no.ssb.dapla.metadata.datadoc;
+
+import java.io.Serializable;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import javax.annotation.processing.Generated;
+import com.fasterxml.jackson.annotation.JsonAnyGetter;
+import com.fasterxml.jackson.annotation.JsonAnySetter;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyDescription;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import jakarta.validation.Valid;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "key",
+ "value"
+})
+@Generated("jsonschema2pojo")
+public class CustomType__1 implements Serializable
+{
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ @JsonPropertyDescription("Custom type KEY")
+ private String key;
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ @JsonPropertyDescription("Custom type VALUE (of type string, array or object).")
+ private Object value;
+ @JsonIgnore
+ @Valid
+ private Map additionalProperties = new LinkedHashMap();
+ private final static long serialVersionUID = 9007834125759711144L;
+
+ /**
+ * No args constructor for use in serialization
+ *
+ */
+ public CustomType__1() {
+ }
+
+ /**
+ *
+ * @param value
+ * Value. Custom type VALUE (of type string, array or object).
+ * @param key
+ * Key. Custom type KEY.
+ */
+ public CustomType__1(String key, Object value) {
+ super();
+ this.key = key;
+ this.value = value;
+ }
+
+ public static CustomType__1 .CustomType__1BuilderBase builder() {
+ return new CustomType__1 .CustomType__1Builder();
+ }
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Key
+ *
+ * Custom type KEY
+ *
+ */
+ @JsonProperty("key")
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ public Object getValue() {
+ return value;
+ }
+
+ /**
+ * Value
+ *
+ * Custom type VALUE (of type string, array or object).
+ *
+ */
+ @JsonProperty("value")
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ @JsonAnyGetter
+ public Map getAdditionalProperties() {
+ return this.additionalProperties;
+ }
+
+ @JsonAnySetter
+ public void setAdditionalProperty(String name, Object value) {
+ this.additionalProperties.put(name, value);
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder sb = new StringBuilder();
+ sb.append(CustomType__1 .class.getName()).append('@').append(Integer.toHexString(System.identityHashCode(this))).append('[');
+ sb.append("key");
+ sb.append('=');
+ sb.append(((this.key == null)?"":this.key));
+ sb.append(',');
+ sb.append("value");
+ sb.append('=');
+ sb.append(((this.value == null)?"":this.value));
+ sb.append(',');
+ sb.append("additionalProperties");
+ sb.append('=');
+ sb.append(((this.additionalProperties == null)?"":this.additionalProperties));
+ sb.append(',');
+ if (sb.charAt((sb.length()- 1)) == ',') {
+ sb.setCharAt((sb.length()- 1), ']');
+ } else {
+ sb.append(']');
+ }
+ return sb.toString();
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 1;
+ result = ((result* 31)+((this.additionalProperties == null)? 0 :this.additionalProperties.hashCode()));
+ result = ((result* 31)+((this.value == null)? 0 :this.value.hashCode()));
+ result = ((result* 31)+((this.key == null)? 0 :this.key.hashCode()));
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == this) {
+ return true;
+ }
+ if ((other instanceof CustomType__1) == false) {
+ return false;
+ }
+ CustomType__1 rhs = ((CustomType__1) other);
+ return ((((this.additionalProperties == rhs.additionalProperties)||((this.additionalProperties!= null)&&this.additionalProperties.equals(rhs.additionalProperties)))&&((this.value == rhs.value)||((this.value!= null)&&this.value.equals(rhs.value))))&&((this.key == rhs.key)||((this.key!= null)&&this.key.equals(rhs.key))));
+ }
+
+ public static class CustomType__1Builder
+ extends CustomType__1 .CustomType__1BuilderBase
+ {
+
+
+ public CustomType__1Builder() {
+ super();
+ }
+
+ public CustomType__1Builder(String key, Object value) {
+ super(key, value);
+ }
+
+ }
+
+ public static abstract class CustomType__1BuilderBase{
+
+ protected T instance;
+
+ @SuppressWarnings("unchecked")
+ public CustomType__1BuilderBase() {
+ // Skip initialization when called from subclass
+ if (this.getClass().equals(CustomType__1 .CustomType__1Builder.class)) {
+ this.instance = ((T) new CustomType__1());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public CustomType__1BuilderBase(String key, Object value) {
+ // Skip initialization when called from subclass
+ if (this.getClass().equals(CustomType__1 .CustomType__1Builder.class)) {
+ this.instance = ((T) new CustomType__1(key, value));
+ }
+ }
+
+ public T build() {
+ T result;
+ result = this.instance;
+ this.instance = null;
+ return result;
+ }
+
+ public CustomType__1 .CustomType__1BuilderBase withKey(String key) {
+ ((CustomType__1) this.instance).key = key;
+ return this;
+ }
+
+ public CustomType__1 .CustomType__1BuilderBase withValue(Object value) {
+ ((CustomType__1) this.instance).value = value;
+ return this;
+ }
+
+ public CustomType__1 .CustomType__1BuilderBase withAdditionalProperty(String name, Object value) {
+ ((CustomType__1) this.instance).additionalProperties.put(name, value);
+ return this;
+ }
+
+ }
+
+}
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 e3e3f6fd..1fc860a8 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
@@ -31,7 +31,6 @@
"name",
"description",
"data_source",
- "register_uri",
"population_description",
"version",
"version_description",
@@ -40,6 +39,10 @@
"subject_field",
"keyword",
"spatial_coverage_description",
+ "contains_personal_data",
+ "use_restriction",
+ "use_restriction_date",
+ "custom_type",
"id",
"owner",
"file_path",
@@ -99,46 +102,39 @@ public class Dataset implements Serializable
@NotNull
private Dataset.DataSetState datasetState;
/**
- * Reusable langugage string type
+ * Reusableb langugage string type
* (Required)
*
*/
@JsonProperty("name")
@Valid
@NotNull
- private LanguageStringType name;
+ private List