Skip to content

Commit 87acc6f

Browse files
committed
No effective change - tweak javalin test only
1 parent f09e09c commit 87acc6f

File tree

2 files changed

+43
-4
lines changed

2 files changed

+43
-4
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package org.example.myapp.web;
22

33
import io.avaje.http.api.Controller;
4+
import io.avaje.http.api.Default;
45
import io.avaje.http.api.Delete;
56
import io.avaje.http.api.Form;
67
import io.avaje.http.api.Get;
78
import io.avaje.http.api.MediaType;
89
import io.avaje.http.api.Path;
910
import io.avaje.http.api.Post;
1011
import io.avaje.http.api.Produces;
12+
import io.avaje.http.api.QueryParam;
1113
import io.javalin.http.Context;
1214
import io.swagger.v3.oas.annotations.Hidden;
1315
import org.example.myapp.service.MyService;
@@ -62,11 +64,11 @@ HelloDto hello(int id, LocalDate date, String otherParam) {
6264
* Find Hellos by name.
6365
*
6466
* @param name The name to search for
65-
* @param otherParam My option parameter
67+
* @param myParam My option parameter
6668
* @return The Hellos that we found.
6769
*/
6870
@Get("/findbyname/:name")
69-
List<HelloDto> findByName(String name, String otherParam) {
71+
List<HelloDto> findByName(String name, @QueryParam("my-param") @Default("one") String myParam) {
7072
return new ArrayList<>();
7173
}
7274

@@ -104,6 +106,11 @@ void saveForm(HelloForm helloForm) {
104106
System.out.println("saving " + helloForm);
105107
}
106108

109+
@Form @Post("mySave")
110+
void saveForm324(@Default("junk") String name, String email, String url) {
111+
System.out.println("name " + name + " email:" + email + " url:" + url);
112+
}
113+
107114

108115
@Post("saveform2")
109116
@Form

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

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,8 @@
235235
"type" : "string"
236236
}
237237
}, {
238-
"name" : "otherParam",
238+
"name" : "myParam",
239239
"in" : "query",
240-
"description" : "My option parameter",
241240
"schema" : {
242241
"type" : "string"
243242
}
@@ -278,6 +277,39 @@
278277
}
279278
}
280279
},
280+
"/hello/mySave" : {
281+
"post" : {
282+
"tags" : [ ],
283+
"summary" : "",
284+
"description" : "",
285+
"requestBody" : {
286+
"content" : {
287+
"application/x-www-form-urlencoded" : {
288+
"schema" : {
289+
"type" : "object",
290+
"properties" : {
291+
"name" : {
292+
"type" : "string"
293+
},
294+
"email" : {
295+
"type" : "string"
296+
},
297+
"url" : {
298+
"type" : "string"
299+
}
300+
}
301+
}
302+
}
303+
},
304+
"required" : true
305+
},
306+
"responses" : {
307+
"201" : {
308+
"description" : "No content"
309+
}
310+
}
311+
}
312+
},
281313
"/hello/savebean/{foo}" : {
282314
"post" : {
283315
"tags" : [ ],

0 commit comments

Comments
 (0)