Skip to content

[Feature]: support for runtime skip properties inside ModelConverter #4951

@maurotaroni

Description

@maurotaroni

Feature Description

It could be helpful to skip some properties documentation generation inside schemas based on API consuming context (e.g. specific user).

Use Case

The found solution seems to using OpenAPIConfiguration.getUserDefinedOptions(). That information is available inside io.swagger.v3.jaxrs2.Reader but not in ModelConverter.
ModelConverters are accessed through a singleton instance (ModelConverters.getInstance()), so it cannot be customized in a multithread environment where each thread is delegated to generate documentation for a specific user where schema has to be customized, because each thread doesn't have its own ModelConverter's configuration.

Suggested Solution (optional)

The OpenApiContext.setModelConverters(Set<ModelConverter>) seems to be usable to customize on the fly the ModelConverter for specific documentation generation.
But OpenApiContext.read() ignore that ModelConverter's configuration and nothing is being shared with OpenApiReader that continues using the singleton instance (ModelConverters.getInstance())).

Alternatives Considered

I haven't found any other alternatives.

Additional Context

Checklist

  • I have searched the existing issues to ensure this is not a duplicate.
  • This feature would be useful to more than just my use case.
  • I have provided enough detail for the maintainers to understand the scope of the request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions