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

[Feature] Handle classes with same name #2863

Open
ML-Marco opened this issue Jan 17, 2025 · 2 comments
Open

[Feature] Handle classes with same name #2863

ML-Marco opened this issue Jan 17, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@ML-Marco
Copy link

ML-Marco commented Jan 17, 2025

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

If the codebase has classes with the same name but different packages, Sprindoc only adds the Schema of the first one to components.

Describe the solution you'd like

I'd like to have a mechanism, similar to how operation name generation works, where the name of the schema of an identical named class is made unique.

Describe alternatives you've considered

I'm aware of springdoc.use-fqn, however this affects all names of all schemas. These longer names result in longer class names when the definition is used by a code generator. It would be beneficial if name collisions are only avoided when needed.
Additionally it can be a big effort if you have to enable use-fqn in an already existing project.

Additional context

Would you accept a pull request for this kind of feature? Furthermore it would be nice to log a warning if such a case is detected and no collision avoidance exists.

@DmitrySboychakov
Copy link

There is related PR in swagger-core.
It fixing the problem with appending numeral suffix (isn't ideal I know)
swagger-api/swagger-core#4772
Please look at it, if you have any better ideas - I can rework my patch.

@bnasslahsen
Copy link
Collaborator

@ML-Marco,

Please feel free to propose a PR.
Just make sure it doesn't create a lot of regressions on existing projects/tests :)

@bnasslahsen bnasslahsen added the enhancement New feature or request label Jan 18, 2025
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

3 participants