use of com.linkedin.restli.docgen.RestLiDocumentationRenderer in project rest.li by linkedin.
the class TestCustomDocumentationHandler method initClass.
@BeforeClass
public void initClass() throws Exception {
RestLiConfig config = new RestLiConfig();
config.setDocumentationRequestHandler(new DefaultDocumentationRequestHandler() {
@Override
protected RestLiDocumentationRenderer getJsonDocumentationRenderer(DataSchemaResolver schemaResolver, RestLiResourceRelationship relationships) {
return new RestLiJSONDocumentationRenderer(relationships) {
@Override
public void renderDataModel(NamedDataSchema schema, DataMap output, Map<String, String> requestHeaders) throws IOException {
super.renderDataModel(schema, output, requestHeaders);
DataMap schemaData = _codec.stringToMap(schema.toString());
String customName = schema.getFullName() + CUSTOM_SUFFIX;
schemaData.put("name", customName);
output.put(customName, schemaData);
}
};
}
});
super.init(false, config);
}
Aggregations