Skip to content

Commit 2bb8b9f

Browse files
author
Lucy
committed
Properly implement samples, fixing build issues
1 parent e357f7f commit 2bb8b9f

9 files changed

Lines changed: 103 additions & 5 deletions

File tree

docs/generators/java-camel.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
127127
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
128128
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
129129
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
130-
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
130+
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
131131
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
132132
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
133-
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
134133

135134

136135
## IMPORT MAPPING

docs/generators/spring.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,9 @@ These options may be applied as additional-properties (cli) or configOptions (pl
120120
|x-class-extra-annotation|List of custom annotations to be added to model|MODEL|null
121121
|x-field-extra-annotation|List of custom annotations to be added to property|FIELD, OPERATION_PARAMETER|null
122122
|x-operation-extra-annotation|List of custom annotations to be added to operation|OPERATION|null
123-
|x-spring-paginated|Add org.springframework.data.domain.Pageable to controller method. Can be used to handle page & size query parameters|OPERATION|false
123+
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
124124
|x-version-param|Marker property that tells that this parameter would be used for endpoint versioning. Applicable for headers & query params. true/false|OPERATION_PARAMETER|null
125125
|x-pattern-message|Add this property whenever you need to customize the invalidation error message for the regex pattern of a variable|FIELD, OPERATION_PARAMETER|null
126-
|x-spring-paginated|Add `org.springframework.data.domain.Pageable` to controller method. Can be used to handle `page`, `size` and `sort` query parameters. If these query parameters are also specified in the operation spec, they will be removed from the controller method as their values can be obtained from the `Pageable` object.|OPERATION|false
127126

128127

129128
## IMPORT MAPPING

modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-fake-endpoints-models-for-testing-with-spring-pageable.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,38 @@ paths:
171171
type: array
172172
items:
173173
type: string
174+
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
175+
\ x-spring-paginated:true is used."
176+
in: header
177+
name: size
178+
schema:
179+
type: string
180+
- description: "The number of items to return per page. Test QueryParam for\
181+
\ issue #8315 - must be removed when x-spring-paginated:true is used."
182+
in: query
183+
name: size
184+
required: true
185+
schema:
186+
default: 20
187+
minimum: 1
188+
type: integer
189+
- description: "The page to return, starting with page 0. Test QueryParam for\
190+
\ issue #8315 - must be removed when x-spring-paginated:true is used."
191+
in: query
192+
name: page
193+
required: true
194+
schema:
195+
default: 0
196+
minimum: 0
197+
type: integer
198+
- description: "The sorting to apply to the Pageable object. Test QueryParam\
199+
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
200+
in: query
201+
name: sort
202+
required: true
203+
schema:
204+
default: "id,asc"
205+
type: string
174206
responses:
175207
200:
176208
description: successful operation

modules/openapi-generator/src/test/resources/3_0/spring/petstore-with-spring-pageable.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,38 @@ paths:
136136
type: array
137137
items:
138138
type: string
139+
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
140+
\ x-spring-paginated:true is used."
141+
in: header
142+
name: size
143+
schema:
144+
type: string
145+
- description: "The number of items to return per page. Test QueryParam for\
146+
\ issue #8315 - must be removed when x-spring-paginated:true is used."
147+
in: query
148+
name: size
149+
required: true
150+
schema:
151+
default: 20
152+
minimum: 1
153+
type: integer
154+
- description: "The page to return, starting with page 0. Test QueryParam for\
155+
\ issue #8315 - must be removed when x-spring-paginated:true is used."
156+
in: query
157+
name: page
158+
required: true
159+
schema:
160+
default: 0
161+
minimum: 0
162+
type: integer
163+
- description: "The sorting to apply to the Pageable object. Test QueryParam\
164+
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
165+
in: query
166+
name: sort
167+
required: true
168+
schema:
169+
default: "id,asc"
170+
type: string
139171
responses:
140172
200:
141173
description: successful operation

samples/openapi3/client/petstore/spring-cloud-spring-pageable/src/main/java/org/openapitools/api/PetApi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ ResponseEntity<List<Pet>> findPetsByStatus(
169169

170170
ResponseEntity<List<Pet>> findPetsByTags(
171171
@NotNull @Parameter(name = "tags", description = "Tags to filter by", required = true, in = ParameterIn.QUERY) @Valid @RequestParam(value = "tags", required = true) List<String> tags,
172-
@Parameter(name = "size", description = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.") @RequestHeader(value = "size", required = false) String size,
172+
@Parameter(name = "size", description = "A test HeaderParam for issue #8315 - must NOT be removed when x-spring-paginated:true is used.", in = ParameterIn.HEADER) @RequestHeader(value = "size", required = false) String size,
173173
@ParameterObject final Pageable pageable
174174
);
175175

samples/server/petstore/springboot-spring-pageable-delegatePattern-without-j8/src/main/resources/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,36 +191,45 @@ paths:
191191
style: form
192192
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
193193
\ x-spring-paginated:true is used."
194+
explode: false
194195
in: header
195196
name: size
197+
required: false
196198
schema:
197199
type: string
200+
style: simple
198201
- description: "The number of items to return per page. Test QueryParam for\
199202
\ issue #8315 - must be removed when x-spring-paginated:true is used."
203+
explode: true
200204
in: query
201205
name: size
202206
required: true
203207
schema:
204208
default: 20
205209
minimum: 1
206210
type: integer
211+
style: form
207212
- description: "The page to return, starting with page 0. Test QueryParam for\
208213
\ issue #8315 - must be removed when x-spring-paginated:true is used."
214+
explode: true
209215
in: query
210216
name: page
211217
required: true
212218
schema:
213219
default: 0
214220
minimum: 0
215221
type: integer
222+
style: form
216223
- description: "The sorting to apply to the Pageable object. Test QueryParam\
217224
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
225+
explode: true
218226
in: query
219227
name: sort
220228
required: true
221229
schema:
222230
default: "id,asc"
223231
type: string
232+
style: form
224233
responses:
225234
"200":
226235
content:

samples/server/petstore/springboot-spring-pageable-delegatePattern/src/main/resources/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,36 +191,45 @@ paths:
191191
style: form
192192
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
193193
\ x-spring-paginated:true is used."
194+
explode: false
194195
in: header
195196
name: size
197+
required: false
196198
schema:
197199
type: string
200+
style: simple
198201
- description: "The number of items to return per page. Test QueryParam for\
199202
\ issue #8315 - must be removed when x-spring-paginated:true is used."
203+
explode: true
200204
in: query
201205
name: size
202206
required: true
203207
schema:
204208
default: 20
205209
minimum: 1
206210
type: integer
211+
style: form
207212
- description: "The page to return, starting with page 0. Test QueryParam for\
208213
\ issue #8315 - must be removed when x-spring-paginated:true is used."
214+
explode: true
209215
in: query
210216
name: page
211217
required: true
212218
schema:
213219
default: 0
214220
minimum: 0
215221
type: integer
222+
style: form
216223
- description: "The sorting to apply to the Pageable object. Test QueryParam\
217224
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
225+
explode: true
218226
in: query
219227
name: sort
220228
required: true
221229
schema:
222230
default: "id,asc"
223231
type: string
232+
style: form
224233
responses:
225234
"200":
226235
content:

samples/server/petstore/springboot-spring-pageable-without-j8/src/main/resources/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,36 +191,45 @@ paths:
191191
style: form
192192
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
193193
\ x-spring-paginated:true is used."
194+
explode: false
194195
in: header
195196
name: size
197+
required: false
196198
schema:
197199
type: string
200+
style: simple
198201
- description: "The number of items to return per page. Test QueryParam for\
199202
\ issue #8315 - must be removed when x-spring-paginated:true is used."
203+
explode: true
200204
in: query
201205
name: size
202206
required: true
203207
schema:
204208
default: 20
205209
minimum: 1
206210
type: integer
211+
style: form
207212
- description: "The page to return, starting with page 0. Test QueryParam for\
208213
\ issue #8315 - must be removed when x-spring-paginated:true is used."
214+
explode: true
209215
in: query
210216
name: page
211217
required: true
212218
schema:
213219
default: 0
214220
minimum: 0
215221
type: integer
222+
style: form
216223
- description: "The sorting to apply to the Pageable object. Test QueryParam\
217224
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
225+
explode: true
218226
in: query
219227
name: sort
220228
required: true
221229
schema:
222230
default: "id,asc"
223231
type: string
232+
style: form
224233
responses:
225234
"200":
226235
content:

samples/server/petstore/springboot-spring-pageable/src/main/resources/openapi.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,36 +191,45 @@ paths:
191191
style: form
192192
- description: "A test HeaderParam for issue #8315 - must NOT be removed when\
193193
\ x-spring-paginated:true is used."
194+
explode: false
194195
in: header
195196
name: size
197+
required: false
196198
schema:
197199
type: string
200+
style: simple
198201
- description: "The number of items to return per page. Test QueryParam for\
199202
\ issue #8315 - must be removed when x-spring-paginated:true is used."
203+
explode: true
200204
in: query
201205
name: size
202206
required: true
203207
schema:
204208
default: 20
205209
minimum: 1
206210
type: integer
211+
style: form
207212
- description: "The page to return, starting with page 0. Test QueryParam for\
208213
\ issue #8315 - must be removed when x-spring-paginated:true is used."
214+
explode: true
209215
in: query
210216
name: page
211217
required: true
212218
schema:
213219
default: 0
214220
minimum: 0
215221
type: integer
222+
style: form
216223
- description: "The sorting to apply to the Pageable object. Test QueryParam\
217224
\ for issue #8315 - must be removed when x-spring-paginated:true is used."
225+
explode: true
218226
in: query
219227
name: sort
220228
required: true
221229
schema:
222230
default: "id,asc"
223231
type: string
232+
style: form
224233
responses:
225234
"200":
226235
content:

0 commit comments

Comments
 (0)