Skip to content
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

all query parameter's type is string #1926

Closed
wulcy opened this issue Nov 4, 2022 · 2 comments
Closed

all query parameter's type is string #1926

wulcy opened this issue Nov 4, 2022 · 2 comments
Labels
invalid This doesn't seem right

Comments

@wulcy
Copy link

wulcy commented Nov 4, 2022

Describe the bug
all query paramter's type is string.

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
  • 2.6.12
  • What modules and versions of springdoc-openapi are you using?
  • 1.6.12
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
  • json
  • Provide with a sample code (HelloController) or Test that reproduces the problem
@RestController
@RequestMapping("/api")
public class OpenApiController {

    @GetMapping("/test")
    public void test(@ParameterObject QueryParams params) {
    }

}

@Data
public class QueryParams {

    @Schema(title = "intParam")
    private Integer intParam;

}

Expected behavior

  • A clear and concise description of what you expected to happen.
  • intParam's type should be integer
  • What is the expected result using OpenAPI Description (yml or json)?
  • json

Screenshots
If applicable, add screenshots to help explain your problem.
图片

Additional context
Add any other context about the problem here.

@bnasslahsen
Copy link
Contributor

use @Parameter(description = "intParam")
Or in your @Schema add the type definition.

@bnasslahsen bnasslahsen added the invalid This doesn't seem right label Nov 14, 2022
@mmotter
Copy link

mmotter commented Nov 17, 2022

@bnasslahsen In springdoc-openapi 1.6.9 we didn't have to specifically call out the schema type. Version 1.6.10 it appears we now have to define the type definition in only our QueryParam models. Seems kind of redundant to declare a field with a type other than string and then have to use the Schema annotation to again repeat the same type. I was always under the impression that defining the schema type definition was meant to be as an override option.

Can this issue be reopened considering we didn't have to do this in 1.6.9, but now have to in 1.6.10 and later versions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants