Search in sources :

Example 1 with ServerVariables

use of org.eclipse.microprofile.openapi.models.servers.ServerVariables 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;
}
Also used : ServerVariables(org.eclipse.microprofile.openapi.models.servers.ServerVariables) ServerVariablesImpl(org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariablesImpl) AnnotationInstance(org.jboss.jandex.AnnotationInstance)

Aggregations

ServerVariables (org.eclipse.microprofile.openapi.models.servers.ServerVariables)1 AnnotationInstance (org.jboss.jandex.AnnotationInstance)1 ServerVariablesImpl (org.wildfly.swarm.microprofile.openapi.api.models.servers.ServerVariablesImpl)1