use of org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariableImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiParser method readServerVariable.
/**
* Reads a list of {@link ServerVariable} OpenAPI nodes.
* @param node
*/
private ServerVariable readServerVariable(JsonNode node) {
if (node == null) {
return null;
}
ServerVariableImpl model = new ServerVariableImpl();
JsonNode enumNode = node.get(OpenApiConstants.PROP_ENUM);
if (enumNode != null && enumNode.isArray()) {
List<String> enums = new ArrayList<>(enumNode.size());
for (JsonNode n : enumNode) {
enums.add(n.asText());
}
model.setEnumeration(enums);
}
model.setDefaultValue(JsonUtil.stringProperty(node, OpenApiConstants.PROP_DEFAULT));
model.setDescription(JsonUtil.stringProperty(node, OpenApiConstants.PROP_DESCRIPTION));
readExtensions(node, model);
return model;
}
use of org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariableImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiAnnotationScanner method readServerVariable.
/**
* Reads a single ServerVariable annotation.
* @param serverVariableAnno
*/
private ServerVariable readServerVariable(AnnotationInstance serverVariableAnno) {
if (serverVariableAnno == null) {
return null;
}
LOG.debug("Processing a single @ServerVariable annotation.");
ServerVariable variable = new ServerVariableImpl();
variable.setDescription(JandexUtil.stringValue(serverVariableAnno, OpenApiConstants.PROP_DESCRIPTION));
variable.setEnumeration(JandexUtil.stringListValue(serverVariableAnno, OpenApiConstants.PROP_ENUMERATION));
variable.setDefaultValue(JandexUtil.stringValue(serverVariableAnno, OpenApiConstants.PROP_DEFAULT_VALUE));
return variable;
}
Aggregations