this.mapper = mapper;
}
@GET("/@/api-docs/schemas/{fqcn}")
public String getJsonSchema(String fqcn) {
SchemaFactoryWrapper visitor = new SchemaFactoryWrapper();
try {
mapper.acceptJsonFormatVisitor(mapper.constructType(Class.forName(fqcn)), visitor);
} catch (JsonMappingException e) {
throw new IllegalStateException(e);
} catch (ClassNotFoundException e) {
throw new WebException(HttpStatus.NOT_FOUND);
}
try {
return mapper.writerWithDefaultPrettyPrinter()
.writeValueAsString(visitor.finalSchema());
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}