use of io.javalin.plugin.openapi.ui.ReDocOptions in project javalin by tipsy.
the class ExampleController method main.
public static void main(String[] args) {
ObjectMapper objectMapper = new ObjectMapper().setSerializationInclusion(JsonInclude.Include.NON_NULL);
OpenApiOptions openApiOptions = new OpenApiOptions(new Info().version("1.0").description("My Application")).activateAnnotationScanningFor("io.javalin.examples").path("/swagger-docs").swagger(new SwaggerOptions("/swagger").title("My Swagger Documentation")).reDoc(new ReDocOptions("/redoc", new RedocOptionsObject.Builder().setHideDownloadButton(true).setTheme(new RedocOptionsTheme.Builder().setSpacingUnit(10).setTypographyOptimizeSpeed(true).build()).build()).title("My ReDoc Documentation"));
Javalin app = Javalin.create(config -> {
config.registerPlugin(new OpenApiPlugin(openApiOptions));
config.jsonMapper(new JavalinJackson(objectMapper));
}).start(7070);
app.post("/users", ExampleController::create);
}
use of io.javalin.plugin.openapi.ui.ReDocOptions in project cineast by vitrivr.
the class OpenApiCompatHelper method getJavalinOpenApiOptions.
/**
* Creates the Javalin options used to create an OpenAPI specification.
*/
public static OpenApiOptions getJavalinOpenApiOptions(APIConfig config) {
// Default Javalin JSON mapper includes all null values, which breakes the openapi specs.
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.addMixIn(Schema.class, // Makes Schema.exampleFlagSet being ignored by jackson
SchemaMixin.class);
return new OpenApiOptions(() -> getOpenApi(config)).path("/openapi-specs").activateAnnotationScanningFor("org.vitrivr.cineast.api").toJsonMapper(new JacksonToJsonMapper(mapper)).modelConverterFactory(() -> new ModelResolver(mapper)).swagger(new SwaggerOptions("/swagger-ui").title("Swagger UI for Cineast Documentation")).reDoc(new ReDocOptions("/redoc").title("ReDoc for Cineast Documentation"));
}
Aggregations