use of org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariablesImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiParser method readServerVariables.
/**
* Reads the {@link ServerVariables} OpenAPI node.
* @param node
*/
private ServerVariables readServerVariables(JsonNode node) {
if (node == null) {
return null;
}
ServerVariablesImpl model = new ServerVariablesImpl();
for (Iterator<String> iterator = node.fieldNames(); iterator.hasNext(); ) {
String fieldName = iterator.next();
if (!fieldName.toLowerCase().startsWith(OpenApiConstants.EXTENSION_PROPERTY_PREFIX)) {
JsonNode varNode = node.get(fieldName);
ServerVariable varModel = readServerVariable(varNode);
model.put(fieldName, varModel);
}
}
readExtensions(node, model);
return model;
}
use of org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariablesImpl in project wildfly-swarm by wildfly-swarm.
the class OpenApiAnnotationScanner method readServerVariables.
/**
* Reads an array of ServerVariable annotations, returning a new {@link ServerVariables} model. The
* annotation value is an array of ServerVariable annotations.
* @param value
* @return
*/
private ServerVariables readServerVariables(AnnotationValue serverVariableAnnos) {
if (serverVariableAnnos == null) {
return null;
}
LOG.debug("Processing an array of @ServerVariable annotations.");
AnnotationInstance[] nestedArray = serverVariableAnnos.asNestedArray();
ServerVariables variables = new ServerVariablesImpl();
for (AnnotationInstance serverVariableAnno : nestedArray) {
String name = JandexUtil.stringValue(serverVariableAnno, OpenApiConstants.PROP_NAME);
if (name != null) {
variables.addServerVariable(name, readServerVariable(serverVariableAnno));
}
}
return variables;
}
Aggregations