use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project swagger-core by swagger-api.
the class SimpleBuilderTest method writeJson.
public static String writeJson(Object value) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
mapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return mapper.writer(new DefaultPrettyPrinter()).writeValueAsString(value);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project swagger-core by swagger-api.
the class SortedOutputTest method configOutputTest.
@Test(description = "config output test")
public void configOutputTest() throws Exception {
SwaggerConfiguration openApiConfiguration = new SwaggerConfiguration().objectMapperProcessorClass(SortedProcessor.class.getName()).resourcePackages(Collections.singleton("com.my.sorted.resources"));
OpenApiContext ctx = new JaxrsOpenApiContext<>().openApiConfiguration(openApiConfiguration).init();
OpenAPI openApi = ctx.read();
String sorted = ctx.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openApi);
openApiConfiguration = new SwaggerConfiguration().resourcePackages(Collections.singleton("com.my.sorted.resources"));
ctx = new JaxrsOpenApiContext<>().openApiConfiguration(openApiConfiguration).init();
String notSorted = ctx.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openApi);
assertEquals(sorted, expectedSorted);
assertEquals(notSorted, expectedNotSorted);
}
use of org.apache.flink.shaded.jackson2.com.fasterxml.jackson.core.util.DefaultPrettyPrinter in project swagger-core by swagger-api.
the class SortedOutputTest method sortOutputTest.
@Test(description = "sort output test")
public void sortOutputTest() throws Exception {
SwaggerConfiguration openApiConfiguration = new SwaggerConfiguration().sortOutput(true).resourcePackages(Collections.singleton("com.my.sorted.resources"));
OpenApiContext ctx = new JaxrsOpenApiContext<>().openApiConfiguration(openApiConfiguration).init();
OpenAPI openApi = ctx.read();
String sorted = ctx.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openApi);
openApiConfiguration = new SwaggerConfiguration().resourcePackages(Collections.singleton("com.my.sorted.resources"));
ctx = new JaxrsOpenApiContext<>().openApiConfiguration(openApiConfiguration).init();
String notSorted = ctx.getOutputYamlMapper().writer(new DefaultPrettyPrinter()).writeValueAsString(openApi);
assertEquals(sorted, expectedSorted);
assertEquals(notSorted, expectedNotSorted);
}
Aggregations