added class for schema of relations
This commit is contained in:
parent
64511dad2c
commit
da2e0bb1db
|
@ -1,5 +1,6 @@
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import eu.dnetlib.dhp.eosc.model.Relation;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
@ -63,6 +64,23 @@ class GenerateJsonSchema {
|
||||||
System.out.println(new ObjectMapper().writeValueAsString(jsonSchema));
|
System.out.println(new ObjectMapper().writeValueAsString(jsonSchema));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void generateSchemaEoscRelation() throws JsonProcessingException {
|
||||||
|
|
||||||
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
|
AddonModule module = new AddonModule();
|
||||||
|
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(objectMapper,
|
||||||
|
SchemaVersion.DRAFT_7, OptionPreset.PLAIN_JSON)
|
||||||
|
.with(module)
|
||||||
|
.with(Option.SCHEMA_VERSION_INDICATOR)
|
||||||
|
.without(Option.NONPUBLIC_NONSTATIC_FIELDS_WITHOUT_GETTERS);
|
||||||
|
SchemaGeneratorConfig config = configBuilder.build();
|
||||||
|
SchemaGenerator generator = new SchemaGenerator(config);
|
||||||
|
JsonNode jsonSchema = generator.generateSchema(Relation.class);
|
||||||
|
|
||||||
|
System.out.println(new ObjectMapper().writeValueAsString(jsonSchema));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void generateJsonSchema3() throws IOException {
|
void generateJsonSchema3() throws IOException {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue