use of com.networknt.oas.model.Parameter in project light-rest-4j by networknt.
the class RequestValidator method validatePathParameters.
private Status validatePathParameters(final NormalisedPath requestPath, final OpenApiOperation openApiOperation) {
Status status = null;
for (int i = 0; i < openApiOperation.getPathString().parts().size(); i++) {
if (!openApiOperation.getPathString().isParam(i)) {
continue;
}
final String paramName = openApiOperation.getPathString().paramName(i);
final String paramValue = requestPath.part(i);
final Optional<Parameter> parameter = openApiOperation.getOperation().getParameters().stream().filter(p -> p.getIn().equalsIgnoreCase("PATH")).filter(p -> p.getName().equalsIgnoreCase(paramName)).findFirst();
if (parameter.isPresent()) {
return schemaValidator.validate(paramValue, parameter.get().toJson());
}
}
return status;
}
Aggregations