-
Notifications
You must be signed in to change notification settings - Fork 11
avoid base field substitution #123
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
base: main
Are you sure you want to change the base?
Conversation
|
Guys, when are you planning to merge this PR? |
|
|
||
| private void checkForExplicitFieldOverrides(JsonSchema schema) { | ||
| var schemaNode = schema.getSchemaNode(); | ||
| var propertiesNode = schemaNode.get("definitions"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't the propertiesNode be under "properties", instead of "definitions"? Please do not use magic constants, make them actual constants
|
|
||
| log.debug("Getting all fields for class: {}", clazz.getName()); | ||
|
|
||
| // Traverse the class hierarchy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should add a test for this. I'm pretty sure that this wont give you the fieldnames used in the json-schema, since the json property names are defined via Jackson-Annotation, rather than the raw-property names.
| existingProperties.addAll(getAllFieldNames(beanDescription.getBeanClass())); | ||
|
|
||
| // Add standard TMForum properties that should never be overridden by schemas | ||
| existingProperties.add("id"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not every extendable entity has an id or href defined. With this, none such entity could be extended with an id or href.
Greetings @wistefan
I got a ticket because apparently it is possible to change base fields in TMForum using @schemalocation, I dont think this is intended since in the documentation @schemalocation is described for adding additional attributes rather than changing existing ones. Although I might be wrong...
In case it is not intented, here is a PR that tries to solve that problem by checking with beanDescription the fields in the target class as well as the commons
Here is a curl that can trigger this substitution:
Best regards