Skip to content

Commit 646850f

Browse files
authored
Merge pull request #1295 from brhaible/issue-1274
Inside a content, include the mediaType in the location string.
2 parents b763d5e + f20e77f commit 646850f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -955,7 +955,7 @@ public Content getContent(ObjectNode node, String location, ParseResult result){
955955

956956
Set<String> keys = getKeys(node);
957957
for(String key : keys) {
958-
MediaType mediaType = getMediaType((ObjectNode) node.get(key), location, result);
958+
MediaType mediaType = getMediaType((ObjectNode) node.get(key), String.format("%s.'%s'", location, key), result);
959959
if (mediaType != null) {
960960
content.addMediaType(key, mediaType);
961961
}

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/util/OpenAPIDeserializerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ public void testArrayItems() {
791791

792792
OpenAPIV3Parser parser = new OpenAPIV3Parser();
793793
SwaggerParseResult result = parser.readContents(yaml, null, null);
794-
assertEquals(result.getMessages(), Arrays.asList("attribute paths.'/store/inventory'(post).requestBody.content.schema.items is missing"));
794+
assertEquals(result.getMessages(), Arrays.asList("attribute paths.'/store/inventory'(post).requestBody.content.'application/json'.schema.items is missing"));
795795

796796
OpenAPI openAPI = result.getOpenAPI();
797797

0 commit comments

Comments
 (0)