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

incorrect generic param for multi interfaces #1696

Closed
dino-proj opened this issue Jun 3, 2022 · 0 comments
Closed

incorrect generic param for multi interfaces #1696

dino-proj opened this issue Jun 3, 2022 · 0 comments

Comments

@dino-proj
Copy link

dino-proj commented Jun 3, 2022

bug

interface One

public interface ListControllerBase<S extends Service<?, ?>, Vo,  SRC extends CustomQuery> {

  // define an operation
  @Operation(name="list")
  @PostMapping("list")
  default Response<Vo> list(@RequestBody PostBody<SRC> req) {
    // some code
  }
}

interface Two

public interface ExistsControllerBase<S extends Service<?, ?>, EQUERY extends CustomQuery> {

  // define another operation
  @Operation(name="exist")
  @PostMapping("exist")
  default Response<Boolean> exist(@RequestBody PostBody<EQUERY> req) {
    // some code
  }

}

inherit operations from those interfaces defined above

@RestController
@RequestMapping("/v1/{tenant_id:[0-9A-Z]+}/user")
public class UserAdminController implements 
    ListControllerBase<AdminUserService, AdminUserVo, AdminUserSearch>,
    ExistsControllerBase<AdminUserService, UserExistsQuery> {
    // some code
}

the "requestBody" in "/v1/{tenant_id}/user/exist" path get incorrect schema:

"schema": {
   "$ref": "#/components/schemas/PostBodyCustomQuery"
}

the correct schema should be:

"schema": {
   "$ref": "#/components/schemas/PostBodyUserExistsQuery"
}

PostBodyCustomQuery ---> PostBodyUserExistsQuery

fix hint

in file: springdoc-openapi-common/src/main/java/org/springdoc/core/ReturnTypeParser.java

//this method
static ResolvableType resolveVariable(TypeVariable<?> typeVariable, ResolvableType contextType) {

//...
}

pull request: at #1684

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant