org.openapi4j.parser.model.v3.ParameterUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openapi-parser Show documentation
Show all versions of openapi-parser Show documentation
openapi4j schema parser & validator
package org.openapi4j.parser.model.v3;
import org.openapi4j.core.exception.DecodeException;
import org.openapi4j.core.model.OAIContext;
import org.openapi4j.core.model.reference.Reference;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
final class ParameterUtil {
private ParameterUtil() {
}
static List getIn(OAIContext context, Collection parameters, String in) {
List inParameters = new ArrayList<>();
if (parameters != null) {
for (Parameter param : parameters) {
if (param.isRef()) {
Reference ref = context.getReferenceRegistry().getRef(param.getCanonicalRef());
try {
param = ref.getMappedContent(Parameter.class);
} catch (DecodeException e) {
// Will never happen
}
}
if (param != null && in.equalsIgnoreCase(param.getIn())) {
inParameters.add(param);
}
}
}
return inParameters;
}
}