use of org.wildfly.swarm.microprofile.openapi.api.models.examples.ExampleImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiParser method readExample.
/**
* Reads a {@link Example} OpenAPI node.
* @param node
*/
private Example readExample(JsonNode node) {
if (node == null || !node.isObject()) {
return null;
}
ExampleImpl model = new ExampleImpl();
model.setRef(JsonUtil.stringProperty(node, OpenApiConstants.PROP_$REF));
model.setSummary(JsonUtil.stringProperty(node, OpenApiConstants.PROP_SUMMARY));
model.setDescription(JsonUtil.stringProperty(node, OpenApiConstants.PROP_DESCRIPTION));
model.setValue(readObject(node.get(OpenApiConstants.PROP_VALUE)));
model.setExternalValue(JsonUtil.stringProperty(node, OpenApiConstants.PROP_EXTERNAL_VALUE));
readExtensions(node, model);
return model;
}
use of org.wildfly.swarm.microprofile.openapi.api.models.examples.ExampleImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiAnnotationScanner method readExample.
/**
* Reads a Example annotation into a model.
* @param annotation
*/
private Example readExample(AnnotationInstance annotation) {
if (annotation == null) {
return null;
}
LOG.debug("Processing a single @ExampleObject annotation.");
Example example = new ExampleImpl();
example.setSummary(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_SUMMARY));
example.setDescription(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_DESCRIPTION));
example.setValue(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_VALUE));
example.setExternalValue(JandexUtil.stringValue(annotation, OpenApiConstants.PROP_EXTERNAL_VALUE));
example.setRef(JandexUtil.refValue(annotation, RefType.Example));
return example;
}
Aggregations