-
Notifications
You must be signed in to change notification settings - Fork 219
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
[java] Unusable code emitted when a field is overwritten #2304
Comments
thanks for bringing this up. |
I just tested the snippet above with the CLI freshly built from I completely understand the reasons for not doing more advanced "reasoning" and taking "smarter" decisions, completely fine by me as long as the validation rule kicks in. |
what's the current behaviour you're experiencing? |
code is generated, but the |
yeah that property should be skipped and a warning should be emitted since we don't have enough information. And resolving that would mean the derived type would have the property now (it's probably not adding it because it's in the parent). |
I can have a look but I don't guarantee when 🙂 fortunately just got all the relevant PRs merged and this is not directly on my way at the moment. |
@andreaTP I'm getting closer to being able to have a look at this one. Just wanted to confirm you're not working on it at this moment? |
Thanks for checking, I confirm I'm not working on this currently (and tomorrow is liberation day in Pt 🙂 ). |
Actually sorry, I got confused while sorting through issues. Leaving this for now. |
@papegaaij started some interesting work in the space with #2836 you might want to checkout @andreaTP |
@andreaTP to resume our discussion from the PR here. As far as I can remember, from the PR mentioned in my last comment, any property that "overrides" a parent's type property will get a unique name so it doesn't hide it. During serialization/deserialization, due to the structure of things, it should also take precedence. |
Honestly, I do need to try things out again to assess the current status, I'll try to do it somewhere next week. |
Ok, I took a look at the situation using kiota at version
Using the repro description in the initial report I cannot confirm that this is the current behavior. I think that this issue has to remain open, at least for now. |
This is clearly an edge case, but I would still like to report it to gather feedback.
I keep finding this pattern:
The intention is clear, declare an
abstract
List
and have concrete instances of it overwriting theitems
field.It's pretty clearly not defined behavior, but I keep finding it in various places and it shows that, probably, OpenAPI tooling is handling this (most of those)cases according to the intention (as opposed to the spec).
Removing the
items
field from the "parent" produces the expected output.Now, I'm not sure how to proceed here, should we fail instead of silently producing unusable code? Or should we handle this case(since is quite popular) with some kind of overwriting mechanism?
The text was updated successfully, but these errors were encountered: