swagger-api / swagger-api/swagger-core

[Feature]: support for runtime skip properties inside ModelConverter

Open
#4,951 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog Feature
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Read io.swagger.v3.jaxrs2.Reader, OpenApiContext.read(), ModelConverters.getInstance(), and the ModelConverter configuration paths. Trace how OpenAPIConfiguration.getUserDefinedOptions() and OpenApiContext.setModelConverters() are handled during schema generation. Done means defining and implementing a thread-safe way to apply runtime, context-specific property skipping without relying on the singleton converter.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.