Skip to content

Commit f979dbc

Browse files
authored
No effective change - add more parameters to test openapi.json (#599)
Followup PR to come related to incorrect generated openapi.json
1 parent c6fd88c commit f979dbc

File tree

4 files changed

+332
-258
lines changed

4 files changed

+332
-258
lines changed

tests/test-javalin-jsonb/src/main/java/org/example/myapp/web/test/OpenAPIController.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ String testDefaultStatus(Context ctx) {
104104
}
105105

106106
@Delete("/delete/{type}")
107-
String testPathParam(String type, @QueryParam String lastName, @Header String header) {
108-
107+
String testPathParam(String type, @QueryParam String lastName, @QueryParam("q-2") String param2, @Header String contentLength, @Header("x-oh") String otherHeader) {
109108
return "only partial info";
110109
}
111110
}

tests/test-javalin-jsonb/src/main/resources/public/openapi.json

+59
Original file line numberDiff line numberDiff line change
@@ -970,6 +970,65 @@
970970
}
971971
}
972972
},
973+
"/openapi/delete/{type}" : {
974+
"delete" : {
975+
"tags" : [
976+
977+
],
978+
"summary" : "",
979+
"description" : "",
980+
"parameters" : [
981+
{
982+
"name" : "type",
983+
"in" : "path",
984+
"required" : true,
985+
"schema" : {
986+
"type" : "string"
987+
}
988+
},
989+
{
990+
"name" : "lastName",
991+
"in" : "query",
992+
"schema" : {
993+
"type" : "string"
994+
}
995+
},
996+
{
997+
"name" : "param2",
998+
"in" : "query",
999+
"schema" : {
1000+
"type" : "string"
1001+
}
1002+
},
1003+
{
1004+
"name" : "contentLength",
1005+
"in" : "header",
1006+
"schema" : {
1007+
"type" : "string"
1008+
}
1009+
},
1010+
{
1011+
"name" : "otherHeader",
1012+
"in" : "header",
1013+
"schema" : {
1014+
"type" : "string"
1015+
}
1016+
}
1017+
],
1018+
"responses" : {
1019+
"200" : {
1020+
"description" : "",
1021+
"content" : {
1022+
"application/json" : {
1023+
"schema" : {
1024+
"type" : "string"
1025+
}
1026+
}
1027+
}
1028+
}
1029+
}
1030+
}
1031+
},
9731032
"/openapi/get" : {
9741033
"get" : {
9751034
"tags" : [

tests/test-javalin-jsonb/src/test/java/io/avaje/http/generator/JavalinProcessorTest.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,11 @@ public void testOpenAPIGeneration() throws Exception {
170170
final var mapper = new ObjectMapper();
171171
final var expectedOpenApiJson =
172172
mapper.readTree(new File("src/test/resources/expectedOpenApi.json"));
173-
final var generatedOpenApi = mapper.readTree(new File("openapi.json"));
173+
File file = new File("openapi.json");
174+
// Files.copy(file.toPath(), Paths.get("other.json"));
175+
final var generatedOpenApi = mapper.readTree(file);
174176

175-
assert expectedOpenApiJson.equals(generatedOpenApi);
177+
assertThat(generatedOpenApi).isEqualTo(expectedOpenApiJson);
176178
}
177179

178180
@Test

0 commit comments

Comments
 (0)