Skip to content

Commit

Permalink
Merge pull request #1438 from r-sreesaran/issue-1432
Browse files Browse the repository at this point in the history
Fix for issue-1432
gracekarina authored Oct 6, 2020
2 parents ef1a5b0 + 2e84daa commit f78bf0a
Showing 3 changed files with 27 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -394,8 +394,8 @@ public Operation operation(ObjectNode obj, String location, ParseResult result)
ArrayNode parameters = getArray("parameters", obj, false, location, result);
output.setParameters(parameters(parameters, location, result));

ObjectNode responses = getObject("responses", obj, true, location, result);
Map<String, Response> responsesObject = responses(responses, location, result);
ObjectNode responses = getObject("responses", obj, true, location+".responses", result);
Map<String, Response> responsesObject = responses(responses, location+".responses", result);
if (responsesObject != null && responsesObject.size() == 0) {
result.missing(location, "responses");
}
@@ -406,6 +406,7 @@ public Operation operation(ObjectNode obj, String location, ParseResult result)
Iterator<JsonNode> it = array.iterator();
while (it.hasNext()) {
JsonNode n = it.next();

String s = getString(n, location + ".schemes", result);
if (s != null) {
Scheme scheme = Scheme.forValue(s);
@@ -1143,8 +1144,8 @@ public Map<String, Response> responses(ObjectNode node, String location, ParseRe
if (key.startsWith("x-")) {

} else {
ObjectNode obj = getObject(key, node, false, location + ".responses", result);
Response response = response(obj, location + "." + key, result);
ObjectNode obj = getObject(key, node, false, location, result);
Response response = response(obj, location + "."+key, result);
output.put(key, response);
}
}
Original file line number Diff line number Diff line change
@@ -1648,4 +1648,14 @@ public void testIssue913() {
Assert.assertNotNull(swagger.getDefinitions().get("indicatorType"));
Assert.assertEquals(swagger.getDefinitions().get("indicatorType").getProperties().size(), 1);
}

@Test
public void testIssuei432() {

SwaggerDeserializationResult result = new SwaggerParser().readWithInfo("src/test/resources/issue-1432.yaml", null, true);
assertNotNull(result);
assertEquals("attribute paths.'/tickets'(get).responses.200.title is unexpected",result.getMessages().get(0));


}
}
12 changes: 12 additions & 0 deletions modules/swagger-parser/src/test/resources/issue-1432.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
swagger: "2.0"
info:
description: some description
title: data
version: "1"
paths:
/tickets:
get:
responses:
200:
title: abc
description: data

0 comments on commit f78bf0a

Please sign in to comment.