Skip to content

Commit 62a9302

Browse files
viclovskywing328
authored andcommitted
[JAVA][Rest-assured] reqSpec() method has been added into api.mustache for requests custom… (#7556)
* reqSpec() method has been added into api.mustache for requests customisation (group operations) * add - reqSpec() has been added to samples
1 parent ee561fc commit 62a9302

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

modules/swagger-codegen/src/main/resources/Java/libraries/rest-assured/api.mustache

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,14 @@ public class {{classname}} {
7373
return this;
7474
}
7575

76+
/**
77+
* Customise request specification
78+
*/
79+
public {{classname}} reqSpec(Consumer<RequestSpecBuilder> consumer) {
80+
consumer.accept(reqSpec);
81+
return this;
82+
}
83+
7684
{{#operations}}
7785
{{#operation}}
7886
/**

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/AnotherFakeApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public AnotherFakeApi setJSON(JSON json) {
7474
return this;
7575
}
7676

77+
/**
78+
* Customise request specification
79+
*/
80+
public AnotherFakeApi reqSpec(Consumer<RequestSpecBuilder> consumer) {
81+
consumer.accept(reqSpec);
82+
return this;
83+
}
84+
7785
/**
7886
* To test special tags
7987
* To test special tags

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,14 @@ public FakeApi setJSON(JSON json) {
110110
return this;
111111
}
112112

113+
/**
114+
* Customise request specification
115+
*/
116+
public FakeApi reqSpec(Consumer<RequestSpecBuilder> consumer) {
117+
consumer.accept(reqSpec);
118+
return this;
119+
}
120+
113121
/**
114122
*
115123
* Test serialization of outer boolean types

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/FakeClassnameTags123Api.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,14 @@ public FakeClassnameTags123Api setJSON(JSON json) {
7474
return this;
7575
}
7676

77+
/**
78+
* Customise request specification
79+
*/
80+
public FakeClassnameTags123Api reqSpec(Consumer<RequestSpecBuilder> consumer) {
81+
consumer.accept(reqSpec);
82+
return this;
83+
}
84+
7785
/**
7886
* To test class name in snake case
7987
*

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/PetApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ public PetApi setJSON(JSON json) {
105105
return this;
106106
}
107107

108+
/**
109+
* Customise request specification
110+
*/
111+
public PetApi reqSpec(Consumer<RequestSpecBuilder> consumer) {
112+
consumer.accept(reqSpec);
113+
return this;
114+
}
115+
108116
/**
109117
* Add a new pet to the store
110118
*

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/StoreApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ public StoreApi setJSON(JSON json) {
8686
return this;
8787
}
8888

89+
/**
90+
* Customise request specification
91+
*/
92+
public StoreApi reqSpec(Consumer<RequestSpecBuilder> consumer) {
93+
consumer.accept(reqSpec);
94+
return this;
95+
}
96+
8997
/**
9098
* Delete purchase order by ID
9199
* For valid response try integer IDs with value &lt; 1000. Anything above 1000 or nonintegers will generate API errors

samples/client/petstore/java/rest-assured/src/main/java/io/swagger/client/api/UserApi.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ public UserApi setJSON(JSON json) {
102102
return this;
103103
}
104104

105+
/**
106+
* Customise request specification
107+
*/
108+
public UserApi reqSpec(Consumer<RequestSpecBuilder> consumer) {
109+
consumer.accept(reqSpec);
110+
return this;
111+
}
112+
105113
/**
106114
* Create user
107115
* This can only be done by the logged in user.

0 commit comments

Comments
 (0)