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

Override default in child schema should not re-define the same property in the child's generated class #1647

Open
saturna opened this issue Nov 18, 2024 · 0 comments

Comments

@saturna
Copy link

saturna commented Nov 18, 2024

Steps:

  • define parent schema with a required property my_property
  • define child schema that uses extends and references parent schema
  • use default keyword on my_property in the child schema

Expected behaviour:
Child class inherits my_property from parent and does not re-declare it.
Child class's constructor(s) assign my_property a default value

Actual:
Child class re-declares it's own my_property and sets it to a default value
javax.validation detects schema violations because parent.my_property is null

As a workaround I can remove my_property from parent and just make sure to declare them on every child class that has the same parent, but it feels clunky.

The use case here is to have an abstract parent type with concrete types requiring my_property to have a value.

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