Skip to content

Commit

Permalink
Merge pull request #1466 from rsvoboda/openapi-default-content-type
Browse files Browse the repository at this point in the history
OpenAPI - different default content type for pojo and primitives
  • Loading branch information
mjurc authored Oct 9, 2023
2 parents d0b7134 + 18e2bf1 commit 7f35b72
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ private void checkType(Stream<String> jsonPathStream, String type) {
.map(pathChunk -> "'" + pathChunk + "'")
.collect(Collectors.joining("."));
final Map<String, Object> objectMap = response.jsonPath().getMap(jsonPath);
Assertions.assertNotNull(objectMap);
Assertions.assertEquals(1, objectMap.keySet().size());
Assertions.assertEquals(type, objectMap.keySet().iterator().next());
Assertions.assertNotNull(objectMap, "Fails on " + jsonPath);
Assertions.assertEquals(1, objectMap.keySet().size(), "Fails on " + jsonPath);
Assertions.assertEquals(type, objectMap.keySet().iterator().next(), "Fails on " + jsonPath);
}

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/delete-text-plain,delete,text/plain
/delete/no-type,delete,application/json
# TODO uncomment once https://github.com/quarkusio/quarkus/issues/36297 is fixed
#/delete/no-type,delete,text/plain
/delete/text-plain,delete,text/plain
/delete/json,delete,application/json
/delete/octet-stream,delete,application/octet-stream
/patch-text-plain,patch,text/plain
/patch/no-type,patch,application/json
#/patch/no-type,patch,text/plain
/patch/text-plain,patch,text/plain
/patch/json,patch,application/json
/patch/octet-stream,patch,application/octet-stream
/post-text-plain,post,text/plain
/post/no-type,post,application/json
#/post/no-type,post,text/plain
/post/text-plain,post,text/plain
/post/json,post,application/json
/post/octet-stream,post,application/octet-stream
/put-text-plain,put,text/plain
/put/no-type,put,application/json
#/put/no-type,put,text/plain
/put/text-plain,put,text/plain
/put/json,put,application/json
/put/octet-stream,put,application/octet-stream
10 changes: 5 additions & 5 deletions spring/spring-web-reactive/src/test/resources/response-types.csv
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/delete-text-plain,delete,text/plain
/delete/no-type,delete,application/json
/delete/no-type,delete,text/plain
/delete/text-plain,delete,text/plain
/delete/json,delete,application/json
/delete/octet-stream,delete,application/octet-stream
/get-text-plain,get,text/plain
/get/no-type,get,application/json
/get/no-type,get,text/plain
/get/text-plain,get,text/plain
/get/json,get,application/json
/get/octet-stream,get,application/octet-stream
/patch-text-plain,patch,text/plain
/patch/no-type,patch,application/json
/patch/no-type,patch,text/plain
/patch/text-plain,patch,text/plain
/patch/json,patch,application/json
/patch/octet-stream,patch,application/octet-stream
/post-text-plain,post,text/plain
/post/no-type,post,application/json
/post/no-type,post,text/plain
/post/text-plain,post,text/plain
/post/json,post,application/json
/post/octet-stream,post,application/octet-stream
/put-text-plain,put,text/plain
/put/no-type,put,application/json
/put/no-type,put,text/plain
/put/text-plain,put,text/plain
/put/json,put,application/json
/put/octet-stream,put,application/octet-stream
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ private void checkType(Stream<String> jsonPathStream, String type) {
.map(pathChunk -> "'" + pathChunk + "'")
.collect(Collectors.joining("."));
final Map<String, Object> objectMap = response.jsonPath().getMap(jsonPath);
Assertions.assertNotNull(objectMap);
Assertions.assertEquals(1, objectMap.keySet().size());
Assertions.assertEquals(type, objectMap.keySet().iterator().next());
Assertions.assertNotNull(objectMap, "Fails on " + jsonPath);
Assertions.assertEquals(1, objectMap.keySet().size(), "Fails on " + jsonPath);
Assertions.assertEquals(type, objectMap.keySet().iterator().next(), "Fails on " + jsonPath);
}

}
9 changes: 5 additions & 4 deletions spring/spring-web/src/test/resources/request-types.csv
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
/delete-text-plain,delete,text/plain
/delete/no-type,delete,application/json
# TODO uncomment once https://github.com/quarkusio/quarkus/issues/36297 is fixed
#/delete/no-type,delete,text/plain
/delete/text-plain,delete,text/plain
/delete/json,delete,application/json
/delete/octet-stream,delete,application/octet-stream
/patch-text-plain,patch,text/plain
/patch/no-type,patch,application/json
#/patch/no-type,patch,text/plain
/patch/text-plain,patch,text/plain
/patch/json,patch,application/json
/patch/octet-stream,patch,application/octet-stream
/post-text-plain,post,text/plain
/post/no-type,post,application/json
#/post/no-type,post,text/plain
/post/text-plain,post,text/plain
/post/json,post,application/json
/post/octet-stream,post,application/octet-stream
/put-text-plain,put,text/plain
/put/no-type,put,application/json
#/put/no-type,put,text/plain
/put/text-plain,put,text/plain
/put/json,put,application/json
/put/octet-stream,put,application/octet-stream
10 changes: 5 additions & 5 deletions spring/spring-web/src/test/resources/response-types.csv
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
/delete-text-plain,delete,text/plain
/delete/no-type,delete,application/json
/delete/no-type,delete,text/plain
/delete/text-plain,delete,text/plain
/delete/json,delete,application/json
/delete/octet-stream,delete,application/octet-stream
/get-text-plain,get,text/plain
/get/no-type,get,application/json
/get/no-type,get,text/plain
/get/text-plain,get,text/plain
/get/json,get,application/json
/get/octet-stream,get,application/octet-stream
/patch-text-plain,patch,text/plain
/patch/no-type,patch,application/json
/patch/no-type,patch,text/plain
/patch/text-plain,patch,text/plain
/patch/json,patch,application/json
/patch/octet-stream,patch,application/octet-stream
/post-text-plain,post,text/plain
/post/no-type,post,application/json
/post/no-type,post,text/plain
/post/text-plain,post,text/plain
/post/json,post,application/json
/post/octet-stream,post,application/octet-stream
/put-text-plain,put,text/plain
/put/no-type,put,application/json
/put/no-type,put,text/plain
/put/text-plain,put,text/plain
/put/json,put,application/json
/put/octet-stream,put,application/octet-stream

0 comments on commit 7f35b72

Please sign in to comment.