Closed futurely closed 9 years ago
https://github.com/swagger-api/validator-badge/blob/master/src/main/java/com/wordnik/swagger/services/ValidatorService.java
String schemaText = getSchema(); JsonNode schemaObject = MAPPER.readTree(schemaText); JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); JsonSchema schema = factory.getJsonSchema(schemaObject);
The schema can be cached to avoid being downloaded, parsed and built for every request.
private JsonSchema schema; if (schema == null) { String schemaText = getSchema(); JsonNode schemaObject = MAPPER.readTree(schemaText); JsonSchemaFactory factory = JsonSchemaFactory.byDefault(); schema = factory.getJsonSchema(schemaObject); }
can you please send a PR?
well that's no fun. OK i've pushed it for you.
https://github.com/swagger-api/validator-badge/blob/master/src/main/java/com/wordnik/swagger/services/ValidatorService.java
The schema can be cached to avoid being downloaded, parsed and built for every request.