-
Notifications
You must be signed in to change notification settings - Fork 214
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
Incorrect merging of model classes #4428
Comments
Vincent is out this week on vacation. @andrueastman could you investigate? |
Kiota is building an inheritance index here of a type and the types that depend on it from the allOf and using this as a mean of building the discriminator mapping. When the kiota/src/Kiota.Builder/KiotaBuilder.cs Line 2020 in 4335b26
However, when this is done, this is done by passing To resolve this, the kiota/src/Kiota.Builder/KiotaBuilder.cs Line 2030 in 4335b26
|
@andreaTP Just to confirm this issue is related to the comment at #4346 (comment)? |
I have no idea ... |
Why is Kiota using inheritance for
It's meant to be used to compose types, effectively copying the properties of the base |
Unfortunately this is one of the instances where using a validation specification as an IDL shows limitations. Effectively kiota implements the status quo of "OAS chose to use JSON Schema, lots of OAS specs use allOf to model inheritance even though it wasn't designed for that, people expect that convention to work". |
I'm not sure what is going on here (feel free to rephrase the title accordingly), but there is something wrong happening in a (not so)edge case.
Here you have a minimal reproducer description:
Generating code with Kiota we obtain (examples in C# for your convenience but applies to all).
expected:
not expected:
this is surprising, as it seems that
ComponentTwo
is being considered equal toComponentOne
for some reason.The expected output for ComponentTwo should be(code trimmed for clarity):
If
ComponentOne
is not usedComponentTwo
gets generated with the expected shape(it took forever to minimize 😅 ).The text was updated successfully, but these errors were encountered: