File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
springdoc-openapi-starter-common/src/main/java/org/springdoc/core/customizers
springdoc-openapi-tests/springdoc-openapi-data-rest-tests/src/test
java/test/org/springdoc/api/app14 Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -142,7 +142,7 @@ public ParameterIn in() {
142
142
143
143
@ Override
144
144
public String description () {
145
- return parameter .description ();
145
+ return getDescription ( parameterName , parameter .description () );
146
146
}
147
147
148
148
@ Override
@@ -705,6 +705,19 @@ else if (isSpringDataWebPropertiesPresent())
705
705
}
706
706
return name ;
707
707
}
708
+ /**
709
+ * Gets description.
710
+ *
711
+ * @param parameterName the parameter name
712
+ * @param originalDescription the original description
713
+ * @return the description
714
+ */
715
+ private String getDescription (String parameterName , String originalDescription ) {
716
+ if ("page" .equals (parameterName ) && isSpringDataWebPropertiesPresent () &&
717
+ optionalSpringDataWebPropertiesProvider .get ().getSpringDataWebProperties ().getPageable ().isOneIndexedParameters ())
718
+ return "One-based page index (1..N)" ;
719
+ return originalDescription ;
720
+ }
708
721
709
722
/**
710
723
* Gets default value.
@@ -730,6 +743,8 @@ else if (isSpringDataWebPropertiesPresent())
730
743
case "page" :
731
744
if (pageableDefault != null )
732
745
defaultValue = String .valueOf (pageableDefault .page ());
746
+ else if (isSpringDataWebPropertiesPresent () && optionalSpringDataWebPropertiesProvider .get ().getSpringDataWebProperties ().getPageable ().isOneIndexedParameters ())
747
+ defaultValue = "1" ;
733
748
else
734
749
defaultValue = defaultSchemaVal ;
735
750
break ;
Original file line number Diff line number Diff line change 43
43
@ TestPropertySource (properties = { "spring.data.web.pageable.default-page-size=25" ,
44
44
"spring.data.web.pageable.page-parameter=pages" ,
45
45
"spring.data.web.pageable.size-parameter=sizes" ,
46
+ "spring.data.web.pageable.one-indexed-parameters=true" ,
46
47
"spring.data.web.sort.sort-parameter=sorts" })
47
48
@ EnableAutoConfiguration (exclude = {
48
49
RepositoryRestMvcAutoConfiguration .class , SpringDocDataRestConfiguration .class
Original file line number Diff line number Diff line change 21
21
{
22
22
"name" : " pages" ,
23
23
"in" : " query" ,
24
- "description" : " Zero -based page index (0 ..N)" ,
24
+ "description" : " One -based page index (1 ..N)" ,
25
25
"required" : false ,
26
26
"schema" : {
27
27
"minimum" : 0 ,
28
28
"type" : " integer" ,
29
- "default" : 0
29
+ "default" : 1
30
30
}
31
31
},
32
32
{
You can’t perform that action at this time.
0 commit comments