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

OneOfs are not resolved in subtypes #2614

Closed
aykborstelmann opened this issue Jun 5, 2024 · 2 comments
Closed

OneOfs are not resolved in subtypes #2614

aykborstelmann opened this issue Jun 5, 2024 · 2 comments

Comments

@aykborstelmann
Copy link

Describe the bug

Given a super type and a subtype, if you use another supertype on a property of the subtype it is not resolved using oneOfs correctly, as the org.springdoc.core.converters.PolymorphicModelConverter should do.

This is because io.swagger.v3.core.jackson.ModelResolver#resolveSubtypes in ModelResolver:1542 does create the AnnotatedType with (implicitly) resolveAsRef=false.

Thus the ref is never set and thus resolvedSchema.get$ref() == null is false in PolymorphicModelConverter.java:79 and no oneOfs are resolved as expected.

@aykborstelmann
Copy link
Author

If verified that this is indeed a bug, I am willing to propose a solution, by adding a

    if (type.getParent() != null) {
      type.setResolveAsRef(true);
    }

at the start of PolymorphicModelConverter#resolve.

@aykborstelmann
Copy link
Author

I see, this is a duplicate of #2597. Closing this in favor of #2597

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

No branches or pull requests

1 participant