Merge branch 'master' of https://code-repo.d4science.org/D-Net/dhp-schemas
This commit is contained in:
commit
923c0ff803
8
pom.xml
8
pom.xml
|
@ -360,7 +360,12 @@
|
||||||
<groupId>javax.persistence</groupId>
|
<groupId>javax.persistence</groupId>
|
||||||
<artifactId>javax.persistence-api</artifactId>
|
<artifactId>javax.persistence-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.victools</groupId>
|
||||||
|
<artifactId>jsonschema-generator</artifactId>
|
||||||
|
<version>${jsonschemagenerator.version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -377,6 +382,7 @@
|
||||||
<scala.version>2.11.12</scala.version>
|
<scala.version>2.11.12</scala.version>
|
||||||
<junit-jupiter.version>5.6.1</junit-jupiter.version>
|
<junit-jupiter.version>5.6.1</junit-jupiter.version>
|
||||||
<mockito-core.version>3.3.3</mockito-core.version>
|
<mockito-core.version>3.3.3</mockito-core.version>
|
||||||
|
<jsonschemagenerator.version>4.13.0</jsonschemagenerator.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ public class Datasource implements Serializable {
|
||||||
|
|
||||||
private String certificates; // string
|
private String certificates; // string
|
||||||
|
|
||||||
private List<Object> policies; //
|
private List<String> policies; //
|
||||||
|
|
||||||
private Container journal; // issn etc del Journal
|
private Container journal; // issn etc del Journal
|
||||||
|
|
||||||
|
@ -297,11 +297,11 @@ public class Datasource implements Serializable {
|
||||||
this.certificates = certificates;
|
this.certificates = certificates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getPolicies() {
|
public List<String> getPolicies() {
|
||||||
return policies;
|
return policies;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPolicies(List<Object> policiesr3) {
|
public void setPolicies(List<String> policiesr3) {
|
||||||
this.policies = policiesr3;
|
this.policies = policiesr3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
package eu.dnetlib.dhp.schema.oaf.dump;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Disabled;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.github.victools.jsonschema.generator.*;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.schema.dump.oaf.graph.*;
|
||||||
|
|
||||||
|
@Disabled
|
||||||
|
class GenerateJsonSchema {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void generateSchema() {
|
||||||
|
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_7,
|
||||||
|
OptionPreset.PLAIN_JSON)
|
||||||
|
.with(Option.SCHEMA_VERSION_INDICATOR)
|
||||||
|
.without(Option.NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS);
|
||||||
|
configBuilder.forFields().withDescriptionResolver(field -> "Description of " + field.getDeclaredName());
|
||||||
|
SchemaGeneratorConfig config = configBuilder.build();
|
||||||
|
SchemaGenerator generator = new SchemaGenerator(config);
|
||||||
|
JsonNode jsonSchema = generator.generateSchema(GraphResult.class);
|
||||||
|
|
||||||
|
System.out.println(jsonSchema.toString());
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue