Open jleelong opened 6 years ago
Hi @joelittlejohn, do you have any recommendations for above. We're using additionalProperties to store transaction details on bitemporal data, but we can't use that information for comparing two objects.
Thanks!
I think it would be possible for us to support excludedFromEqualsAndHashCode
in the additionalProperties schema, but the feature was never intended to work there. The additional properties java field is effectively a meta field that represents many possible JSON fields, whereas the excludedFromEqualsAndHashCode
extension property was intended to allow excluding specific JSON fields from these methods.
I think it would be reasonable to implement this though, you could probably just do an additional check on the additionalProperties
node here:
Feel free to submit a PR.
isIncludeAdditionalProperties() should return false to exclude additional properties.
Hi @joelittlejohn,
Great tool, thanks for providing it to the community! Quick question, I would like to exclude additionalProperties from the generated hashCode and equals methods. I'm also using a custom schema definition for additionalProperties, not sure if that makes a difference? I've tried to exclude the additionalProperties below but it doesn't appear to give the expected result.
Schema Definition
Source Generator I'm also using the Java API to read the schemas and generate source files
Generated Methods Unfortunately the additionalProperties are still added to the generated methods
I'm using version 0.5.1 with jdk 1.8.0_121. Let me know if you need any other information and thanks in advance for your help.
Kind Regards, Lee Long