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() {
142142
143143 @ Override
144144 public String description () {
145- return parameter .description ();
145+ return getDescription ( parameterName , parameter .description () );
146146 }
147147
148148 @ Override
@@ -705,6 +705,19 @@ else if (isSpringDataWebPropertiesPresent())
705705 }
706706 return name ;
707707 }
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+ }
708721
709722 /**
710723 * Gets default value.
@@ -730,6 +743,8 @@ else if (isSpringDataWebPropertiesPresent())
730743 case "page" :
731744 if (pageableDefault != null )
732745 defaultValue = String .valueOf (pageableDefault .page ());
746+ else if (isSpringDataWebPropertiesPresent () && optionalSpringDataWebPropertiesProvider .get ().getSpringDataWebProperties ().getPageable ().isOneIndexedParameters ())
747+ defaultValue = "1" ;
733748 else
734749 defaultValue = defaultSchemaVal ;
735750 break ;
Original file line number Diff line number Diff line change 4343@ TestPropertySource (properties = { "spring.data.web.pageable.default-page-size=25" ,
4444 "spring.data.web.pageable.page-parameter=pages" ,
4545 "spring.data.web.pageable.size-parameter=sizes" ,
46+ "spring.data.web.pageable.one-indexed-parameters=true" ,
4647 "spring.data.web.sort.sort-parameter=sorts" })
4748@ EnableAutoConfiguration (exclude = {
4849 RepositoryRestMvcAutoConfiguration .class , SpringDocDataRestConfiguration .class
Original file line number Diff line number Diff line change 2121 {
2222 "name" : " pages" ,
2323 "in" : " query" ,
24- "description" : " Zero -based page index (0 ..N)" ,
24+ "description" : " One -based page index (1 ..N)" ,
2525 "required" : false ,
2626 "schema" : {
2727 "minimum" : 0 ,
2828 "type" : " integer" ,
29- "default" : 0
29+ "default" : 1
3030 }
3131 },
3232 {
You can’t perform that action at this time.
0 commit comments