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

Builders do not preserve additionalProperties #3570

Closed
shawkins opened this issue Nov 4, 2021 · 5 comments · Fixed by #3576
Closed

Builders do not preserve additionalProperties #3570

shawkins opened this issue Nov 4, 2021 · 5 comments · Fixed by #3576
Assignees
Labels
Milestone

Comments

@shawkins
Copy link
Contributor

shawkins commented Nov 4, 2021

When using a builder and you use a withXXX to associate another object - under the covers the a copy is made via a constructor that omits the additional properties.

@manusa
Copy link
Member

manusa commented Nov 5, 2021

Is this something that needs to be fixed here or in Sundrio?

A reproducer example, or ignored test would be useful.

@manusa manusa added the bug label Nov 5, 2021
@shawkins
Copy link
Contributor Author

shawkins commented Nov 5, 2021

Is this something that needs to be fixed here or in Sundrio?

I think here. There's no constructor nor setter for the building logic to use to convey the additionalProperties. If I modify Pod.java to have a setter, the the fluent / builder is updated appropriately.

@shawkins
Copy link
Contributor Author

shawkins commented Nov 5, 2021

@manusa @iocanel or do you want an upstream issue about understanding the existing setAdditionalProperty? A possible issue with that is that it's not symmetric - there's only getAdditionalProperties,

@manusa
Copy link
Member

manusa commented Nov 8, 2021

A possible issue with that is that it's not symmetric - there's only getAdditionalProperties

I think jsonschema2pojo is in charge of generating the additionalProperties field and related methods (property setter, and getter).

I'm not sure if this can be tweaked to be able to add a normal setter too and prevent the problem. But if there's no option, it seems like a hard problem to tackle then.

And I think the issue is similar for the constructor.

@manusa
Copy link
Member

manusa commented Nov 8, 2021

We can try to implement an extra rule (jsonschema2pojo) to complement the AdditionalPropertiesRule and generate the missing setter.

We already have some custom rules to fix the naming convention (#2639)

shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 9, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 9, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 9, 2021
shawkins added a commit to shawkins/kubernetes-client that referenced this issue Nov 9, 2021
manusa pushed a commit to shawkins/kubernetes-client that referenced this issue Nov 11, 2021
@manusa manusa linked a pull request Nov 11, 2021 that will close this issue
11 tasks
@manusa manusa added this to the 5.10.0 milestone Nov 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants