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