File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed
springdoc-openapi-common/src/main/java/org/springdoc/core/customizers
springdoc-openapi-data-rest/src/test
java/test/org/springdoc/api/app14 Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ public ParameterIn in() {
141
141
142
142
@ Override
143
143
public String description () {
144
- return parameter .description ();
144
+ return getDescription ( parameterName , parameter .description () );
145
145
}
146
146
147
147
@ Override
@@ -705,6 +705,20 @@ else if (isSpringDataWebPropertiesPresent())
705
705
return name ;
706
706
}
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
+ }
721
+
708
722
/**
709
723
* Gets default value.
710
724
*
@@ -742,6 +756,8 @@ else if (isSpringDataWebPropertiesPresent())
742
756
case "page" :
743
757
if (pageableDefault != null )
744
758
defaultValue = String .valueOf (pageableDefault .page ());
759
+ else if (isSpringDataWebPropertiesPresent () && optionalSpringDataWebPropertiesProvider .get ().getSpringDataWebProperties ().getPageable ().isOneIndexedParameters ())
760
+ defaultValue = "1" ;
745
761
else
746
762
defaultValue = defaultSchemaVal ;
747
763
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