Skip to content

Commit 7529f86

Browse files
authored
Merge pull request #12541 from RusJaI/empty-resource-check
Fix empty resource paths not caught by the existing validation logic implementation
2 parents d7d2dca + 0f5fab1 commit 7529f86

File tree

1 file changed

+3
-1
lines changed
  • components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions

1 file changed

+3
-1
lines changed

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/definitions/OAS2Parser.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,10 @@ public APIDefinitionValidationResponse validateAPIDefinition(String apiDefinitio
685685
// Which is a known issue of Swagger 2.0 parser
686686
Set<URITemplate> uriTemplates = null;
687687
uriTemplates = getURITemplates(apiDefinition);
688-
if (uriTemplates == null) {
688+
if (uriTemplates.size() == 0) {
689689
validationResponse.setValid(false);
690+
OASParserUtil.addErrorToValidationResponse(validationResponse,
691+
"Empty resource paths found in the swagger definition");
690692
return validationResponse;
691693
} else {
692694
for (URITemplate uriTemplate : uriTemplates) {

0 commit comments

Comments
 (0)