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() {
141141
142142 @ Override
143143 public String description () {
144- return parameter .description ();
144+ return getDescription ( parameterName , parameter .description () );
145145 }
146146
147147 @ Override
@@ -705,6 +705,20 @@ else if (isSpringDataWebPropertiesPresent())
705705 return name ;
706706 }
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+ }
721+
708722 /**
709723 * Gets default value.
710724 *
@@ -742,6 +756,8 @@ else if (isSpringDataWebPropertiesPresent())
742756 case "page" :
743757 if (pageableDefault != null )
744758 defaultValue = String .valueOf (pageableDefault .page ());
759+ else if (isSpringDataWebPropertiesPresent () && optionalSpringDataWebPropertiesProvider .get ().getSpringDataWebProperties ().getPageable ().isOneIndexedParameters ())
760+ defaultValue = "1" ;
745761 else
746762 defaultValue = defaultSchemaVal ;
747763 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