From d0ff2a56fb028ae809bf214baef413042265e0ca Mon Sep 17 00:00:00 2001 From: "miriam.baglioni" Date: Wed, 29 Jul 2020 17:06:53 +0200 Subject: [PATCH] - --- .../dhp/oa/graph/dump/GenerateJsonSchema.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/GenerateJsonSchema.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/GenerateJsonSchema.java index ba4bac45b..9c02ea5f4 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/GenerateJsonSchema.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/GenerateJsonSchema.java @@ -1,22 +1,26 @@ + package eu.dnetlib.dhp.oa.graph.dump; +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.Result; -import org.junit.jupiter.api.Test; public class GenerateJsonSchema { - @Test - public 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(Result.class); + @Test + public 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(Result.class); - System.out.println(jsonSchema.toString()); -} + System.out.println(jsonSchema.toString()); + } }