-
-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Parameter Name with Default Sort #1010
Comments
The wrong parameter naming is now fixed. Note that For the default value of the This is unfortunate, because the This can be added through |
@bnasslahsen Isn't |
it is indeed... This is a first sample to show the problem that @SpringBootApplication
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
ResolvedSchema resolvedSchema = ModelConverters.getInstance()
.resolveAsResolvedSchema(new AnnotatedType(Sample.class));
ArraySchema arraySchema = (ArraySchema) resolvedSchema.schema.getProperties().get("sort");
Assert.isTrue( !String.class.equals(arraySchema.getDefault().getClass()), "The result should not be of type string" );
}
class Sample {
@io.swagger.v3.oas.annotations.media.ArraySchema(arraySchema = @Schema(defaultValue = "[\"sample1\", \"sample1\"]"))
@JsonProperty
private List<String> sort;
}
} I have added a workaround for that. This is not the ideal solution, but should make it work. |
Describe the bug
When a controller
Pageable
method parameter is annotated with@PageableDefault
and a sort Parameter is given in the annotation the parameter name for the sort is not sort. Instead it is the value of the sort Parameter.The cause is:
springdoc-openapi/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java
Lines 409 to 410 in c567f67
To Reproduce
Following Controller Method triggers the bug
leads to:
Expected behavior
the field name should stay
sort
the default value should besomeField,asc
(notice value + sort direction)The only time the field name should be changed, is when annotated with
@Qualifier
which seems also not supported.Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: