Skip to content

Commit bfbc1e3

Browse files
author
bnasslahsen
committed
Description for Pageable parameters is not displayed in swagger-ui. Fixes #543.
1 parent bfed970 commit bfbc1e3

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/converters/Pageable.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import javax.validation.constraints.Min;
2626
import javax.validation.constraints.NotNull;
2727

28+
import io.swagger.v3.oas.annotations.Parameter;
2829
import io.swagger.v3.oas.annotations.media.ArraySchema;
2930
import io.swagger.v3.oas.annotations.media.Schema;
3031

@@ -33,20 +34,19 @@
3334
@NotNull
3435
public class Pageable {
3536

36-
@Nullable
3737
@Min(0)
38-
@Schema(description = "Zero-based page index (0..N)", defaultValue = "0")
38+
@Parameter(description = "Zero-based page index (0..N)",schema = @Schema(type = "integer", defaultValue = "0"),required = true)
3939
private Integer page;
4040

41-
@Nullable
4241
@Min(1)
4342
@Max(2000)
44-
@Schema(description = "The size of the page to be returned", defaultValue = "20")
43+
@Parameter(description = "The size of the page to be returned",schema = @Schema(type = "integer", defaultValue = "20"),required = true)
4544
private Integer size;
4645

47-
@Nullable
48-
@ArraySchema(arraySchema = @Schema(description = "Sorting criteria in the format: property(,asc|desc). "
49-
+ "Default sort order is ascending. " + "Multiple sort criteria are supported."))
46+
@Parameter(description = "Sorting criteria in the format: property(,asc|desc). "
47+
+ "Default sort order is ascending. " + "Multiple sort criteria are supported."
48+
, name = "sort"
49+
,array = @ArraySchema(schema = @Schema(type = "string")),required = true)
5050
private List<String> sort;
5151

5252
public Pageable(int page, int size, List<String> sort) {

springdoc-openapi-data-rest/src/test/resources/results/app2.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,26 +56,26 @@
5656
"components": {
5757
"schemas": {
5858
"Pageable": {
59+
"required": [
60+
"page",
61+
"size",
62+
"sort"
63+
],
5964
"type": "object",
6065
"properties": {
6166
"page": {
6267
"minimum": 0,
6368
"type": "integer",
64-
"description": "Zero-based page index (0..N)",
65-
"format": "int32",
66-
"default": 0
69+
"format": "int32"
6770
},
6871
"size": {
6972
"maximum": 2000,
7073
"minimum": 1,
7174
"type": "integer",
72-
"description": "The size of the page to be returned",
73-
"format": "int32",
74-
"default": 20
75+
"format": "int32"
7576
},
7677
"sort": {
7778
"type": "array",
78-
"description": "Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.",
7979
"items": {
8080
"type": "string"
8181
}

springdoc-openapi-data-rest/src/test/resources/results/app7.json

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,33 @@
2121
{
2222
"name": "page",
2323
"in": "query",
24-
"required": false,
24+
"description": "Zero-based page index (0..N)",
25+
"required": true,
2526
"schema": {
2627
"minimum": 0,
2728
"type": "integer",
28-
"description": "Zero-based page index (0..N)",
29-
"format": "int32",
30-
"default": 0
29+
"default": "0"
3130
}
3231
},
3332
{
3433
"name": "size",
3534
"in": "query",
36-
"required": false,
35+
"description": "The size of the page to be returned",
36+
"required": true,
3737
"schema": {
3838
"maximum": 2000,
3939
"minimum": 1,
4040
"type": "integer",
41-
"description": "The size of the page to be returned",
42-
"format": "int32",
43-
"default": 20
41+
"default": "20"
4442
}
4543
},
4644
{
4745
"name": "sort",
4846
"in": "query",
49-
"required": false,
47+
"description": "Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.",
48+
"required": true,
5049
"schema": {
5150
"type": "array",
52-
"description": "Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.",
5351
"items": {
5452
"type": "string"
5553
}

0 commit comments

Comments
 (0)