use of com.github.victools.jsonschema.generator.SchemaGenerator in project jsonschema-generator by victools.
the class IntegrationTest method testIntegration.
/**
* Test
*
* @throws Exception
*/
@Test
public void testIntegration() throws Exception {
// active all optional modules
SwaggerModule module = new SwaggerModule(SwaggerOption.ENABLE_PROPERTY_NAME_OVERRIDES, SwaggerOption.IGNORING_HIDDEN_PROPERTIES);
SchemaGeneratorConfig config = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_2019_09, OptionPreset.FULL_DOCUMENTATION).with(Option.NULLABLE_ARRAY_ITEMS_ALLOWED).with(module).build();
SchemaGenerator generator = new SchemaGenerator(config);
JsonNode result = generator.generateSchema(TestClass.class);
String rawJsonSchema = result.toString();
JSONAssert.assertEquals('\n' + rawJsonSchema + '\n', loadResource("integration-test-result.json"), rawJsonSchema, JSONCompareMode.STRICT);
}
use of com.github.victools.jsonschema.generator.SchemaGenerator in project jsonschema-generator by victools.
the class IntegrationTest method testIntegration.
@Test
@Parameters
public void testIntegration(Class<?> rawTargetType) throws Exception {
Swagger2Module module = new Swagger2Module();
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_2019_09, OptionPreset.PLAIN_JSON).with(Option.DEFINITIONS_FOR_ALL_OBJECTS, Option.NULLABLE_ARRAY_ITEMS_ALLOWED).with(Option.NONSTATIC_NONVOID_NONGETTER_METHODS, Option.FIELDS_DERIVED_FROM_ARGUMENTFREE_METHODS).with(module);
SchemaGenerator generator = new SchemaGenerator(configBuilder.build());
JsonNode result = generator.generateSchema(rawTargetType);
String rawJsonSchema = result.toString();
JSONAssert.assertEquals('\n' + rawJsonSchema + '\n', loadResource("integration-test-result-" + rawTargetType.getSimpleName() + ".json"), rawJsonSchema, JSONCompareMode.STRICT);
}
use of com.github.victools.jsonschema.generator.SchemaGenerator in project alfresco-java-sdk by Alfresco.
the class JsonSchemaGeneratorTest method jsonSchema.
@Test
public void jsonSchema() {
for (final EventEntry entry : EventEntry.values()) {
final SchemaGeneratorConfigBuilder configBuilder = getConfigBuilder(entry);
final SchemaGeneratorConfig config = configBuilder.build();
final SchemaGenerator generator = new SchemaGenerator(config);
final JsonNode jsonSchema = generator.generateSchema(RepoEvent.class);
entry.fileNames.forEach(file -> writeToFile(jsonSchema, file));
}
}
use of com.github.victools.jsonschema.generator.SchemaGenerator in project tapestry-5 by apache.
the class RestJacksonModule method buildSchemaGenerator.
/**
* Provides the default {@link SchemaGenerator} instance with a default configuration.
*/
public static SchemaGenerator buildSchemaGenerator() {
SchemaGeneratorConfigBuilder configBuilder = new SchemaGeneratorConfigBuilder(SchemaVersion.DRAFT_2019_09, OptionPreset.PLAIN_JSON);
SchemaGeneratorConfig config = configBuilder.build();
return new SchemaGenerator(config);
}
Aggregations