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

[Composite types] When allOf contains only one type don't generate union classes #2054

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

SergioArrighi
Copy link

Hello all,

I don't know if this may be of interest, but I think I saw some issues logged here and there of people asking for this kind of behaviour.
I originally wanted to make it optional, but I did't find any way to have some kind of configuration.

Thanks for the awesome work everybody and best regards.

@gracekarina
Copy link
Contributor

gracekarina commented Feb 13, 2024

Hi @SergioArrighi, this change breaks many tests, this could be added as an option if you follow the logic of the resolveCombinators option. thanks

Failures:
Error: OpenAPIResolverTest.componentsResolver:417 ClassCast class io.swagger.v3.oas.models.media.ObjectSchema cannot be cast to class io.swagger.v3.oas.models.media.ComposedSchema (io.swagger.v3.oas.models.media.ObjectSchema and io.swagger.v3.oas.models.media.ComposedSchema are in unnamed module of loader 'app')
Error: OpenAPIResolverTest.testComposedSchemaAdjacent:1012 NullPointer
Error: OpenAPIV3ParserTest.testComposedSchemaAdjacent:1396 NullPointer
Error: OpenAPIV3ParserTest.testIssue1777:128 expected [The id of the customer] but found [null]
Error: OpenAPIV3ParserTest.testIssue1802:143 expected object to not be null
Error: OpenAPIV3ParserTest.testIssueDereferencingComposedSchemaOneOf:84 expected object to not be null
Error: OpenAPIV3ParserTest.testOneOfExternalRefConflictName:1405 NullPointer
Error: OpenAPIDeserializerTest.testIssue1454AllOfDefaultValue:2892 expected [SCHEMA_DEFAULT] but found [null]

@gracekarina gracekarina self-requested a review February 13, 2024 18:29
if (n.isObject()) {
schema = getSchema((ObjectNode) n, location, result);
composedSchema.addAllOfItem(schema);
if (allOfArray.size() > 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is going to be a new behavior, you could add it as an option, as the option resolveCombinators

Copy link
Contributor

@gracekarina gracekarina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is going to be a new behavior, you could add it as an option, as the option resolveCombinators

@SergioArrighi
Copy link
Author

Hello @gracekarina ,
thanks for the time you took to review this PR. Yes I first wanted to understand if it would be interesting for the project to have this kind of possibility and also to get some guidance on how to have a feature toggle for it. I will look into "resolveCombinators" as soon as I will have some time.
Thanks again for the review and for your work.
Regards

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

Successfully merging this pull request may close these issues.

None yet

2 participants