swagger-api / swagger-api/swagger-core

ModelConverterRegistrar should care the order

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

Nobody has claimed this yet.

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

Description

Is your feature request related to a problem? Please describe.

I got the oneOf property is not work issue, but no fix yet.
https://github.com/swagger-api/swagger-core/issues/4732

In the meantime, I am working on my own ModelConverter to hack the result.
I use this code to add my converter.

        ModelConverters.getInstance().addConverter(new MyCustomResolver());

But I found the Springdoc have its own converter too, and it overwrite my result.
I think the reason is because the order of the converters in ModelConverters.

Describe the solution you'd like
Maybe just use Spring @Order annotation?

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

Start by reading ModelConverters and the converter registration path, then compare the custom MyCustomResolver setup with the Springdoc converter mentioned in the issue. Check issue 4732 for related context; the work is done when converter ordering is defined so a custom converter's result is not unexpectedly overwritten.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.