Revert "[Graph Dump] added test class to generate the json schema of the dump"
This reverts commit fb0139c09a
.
This commit is contained in:
parent
9c2aadac92
commit
baef47b360
|
@ -1,46 +0,0 @@
|
||||||
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 com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
|
|
||||||
import com.github.imifou.jsonschema.module.addon.AddonModule;
|
|
||||||
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void generateSchema2(){
|
|
||||||
|
|
||||||
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(GraphResult.class);
|
|
||||||
|
|
||||||
System.out.println(jsonSchema.toString());
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue