Closed Adam724 closed 5 months ago
THANK YOU!
Glad it is working! If you could take a look at this PR when you get a chance, that'd be great. Realized while testing a bit more today that the logic for omitEmpty
is not right. It needs to still check whether the field is optional first before adding the tag. Ideally there would be a test case to catch this, but doesn't look like the current capabilities support passing CLI options to tests. I am looking into adding this, but will include it in a different PR since it's more involved.
This PR introduced a new option to allow optional struct fields to be set to omitempty. However, it does not properly evaluate the boolean condition, and always behaves as if the option is set to true. This is causing some tests to fail unexpectedly when fields are set to null. The generated code contains the omitempty flag erroneously and thus ignores the null field when generating JSON output, causing the input/output JSON not to match. This PR fixes #2462.