File tree Expand file tree Collapse file tree
groovy/com/github/hauner/openapi/generatr
resources/params-request-body Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ class GeneratrPendingTest extends GeneratrTestBase {
2727 @Parameterized.Parameters (name = " {0}" )
2828 static Collection<TestSet > sources () {
2929 return [
30- new TestSet (name : ' path- params-simple-data-types ' )
30+ new TestSet (name : ' params-request-body ' )
3131 ]
3232 }
3333
Original file line number Diff line number Diff line change 1+ /*
2+ * This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+ * DO NOT EDIT.
4+ */
5+
6+ package generated .api ;
7+
8+ import generated .model .Book ;
9+ import org .springframework .http .ResponseEntity ;
10+ import org .springframework .web .bind .annotation .PostMapping ;
11+
12+ public interface Api {
13+
14+ @ PostMapping (path = "/book" , consumes = {"application/json" }, produces = {"application/json" })
15+ ResponseEntity <Book > postBook (@ RequestBody Book body );
16+
17+ }
Original file line number Diff line number Diff line change 1+ /*
2+ * This class is auto generated by https://github.com/hauner/openapi-generatr-spring.
3+ * DO NOT EDIT.
4+ */
5+
6+ package generated .model ;
7+
8+ import com .fasterxml .jackson .annotation .JsonProperty ;
9+
10+ public class Book {
11+
12+ @ JsonProperty ("isbn" )
13+ private String isbn ;
14+
15+ @ JsonProperty ("title" )
16+ private String title ;
17+
18+ public String getIsbn () {
19+ return isbn ;
20+ }
21+
22+ public void setIsbn (String isbn ) {
23+ this .isbn = isbn ;
24+ }
25+
26+ public String getTitle () {
27+ return title ;
28+ }
29+
30+ public void setTitle (String title ) {
31+ this .title = title ;
32+ }
33+
34+ }
Original file line number Diff line number Diff line change 1+ openapi : 3.0.2
2+ info :
3+ title : test request body parameters
4+ version : 1.0.0
5+
6+ paths :
7+ /book :
8+ post :
9+ requestBody :
10+ content :
11+ application/json :
12+ schema :
13+ $ref : ' #/components/schemas/Book'
14+ responses :
15+ ' 201 ' :
16+ description : created book
17+ content :
18+ application/json :
19+ schema :
20+ $ref : ' #/components/schemas/Book'
21+
22+ components :
23+ schemas :
24+ Book :
25+ type : object
26+ properties :
27+ isbn :
28+ type : string
29+ title :
30+ type : string
You can’t perform that action at this time.
0 commit comments