Libs(Go): unestting nullable array fields via PATCH request #1496
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work was done previously [1] to make nullable containers (arrays, maps) generate as refs. This avoided a problem where the JSON serialization code incrrectly sent an empty array for cases where a field was left unset. This would result in requests incorrectly failing with a 422 response when it should have been OK.
During the openapi generator update [2], the resulting codegen no longer had the 422 issue since it correctly omitted empty arrays from the body for PATCH requests. However, this now means we have no way to explicitly set a field to
null
. This specific issue was fixed in the some other langs with the work done to update the generator, but the Go generator seems to have fallen behind.This rev adds tests to demonstrate the shortfall. We may need to rework the template patch made for the old 5.x generator to solve this in the meantime.
Motivation
Solution