Skip to content

Make calculateSchema method public #455

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

Closed
cnusp opened this issue Feb 23, 2020 · 2 comments
Closed

Make calculateSchema method public #455

cnusp opened this issue Feb 23, 2020 · 2 comments
Labels
enhancement New feature or request

Comments

@cnusp
Copy link

cnusp commented Feb 23, 2020

Feature Description
I use my custom implementation of the OpenApiCustomiser interface to complete the auto-generated Open API specification. I inject the ResponseBuilder object to calculate Schema instances that describe non-2xx response bodies. Since ResponseBuilder's calculateSchema method is a private method, it can only be called through reflection.

To Reproduce
Steps to reproduce the behavior:

  • Inject ResponseBuilder into a @Component
  • Try to call ResponseBuilder::calculateSchema(...)
  • Compiler error: 'calculateSchema(io.swagger.v3.oas.models.Components, java.lang.reflect.ParameterizedType, com.fasterxml.jackson.annotation.JsonView)' has private access in 'org.springdoc.core.AbstractResponseBuilder'

Expected behavior
ResponseBuilder::calculateSchema(...) should be a public method.

One of the core functionalities of ResponseBuilder is providing schema calculation functionality. I see no other way of easily calculating the schema of an arbitrary type, thus ResponseBuilder::calculateSchema(...) should be public, not private.

@bnasslahsen
Copy link
Collaborator

@cnusp,

calculateSchema, is private, because its internally used by ResponseBuilder.
There was no reason to expose it. You are asking for new feature...
Plese, note that people can just use: SpringDocAnnotationsUtils.extractSchema or AnnotationsUtils.resolveSchemaFromType to resovle the Schema directly.

@bnasslahsen bnasslahsen changed the title calculateSchema method is private Make calculateSchema method is private Feb 23, 2020
@bnasslahsen bnasslahsen changed the title Make calculateSchema method is private Make calculateSchema methodprivate Feb 23, 2020
@bnasslahsen bnasslahsen changed the title Make calculateSchema methodprivate Make calculateSchema method public Feb 23, 2020
@cnusp
Copy link
Author

cnusp commented Feb 23, 2020

Thank you. SpringDocAnnotationsUtils.extractSchema is providing the desired functionality.

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

No branches or pull requests

2 participants