fix: respect requestBody.required in strict server #1936
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.
I noticed that
requestBody.required
wasn't being respected and requests without a body were failing with an[EOF]
error even though required was set to false.This PR is a tentative fix to this issue. It certainly works as my API now behaves according to the spec and it fails without a body only if
required: true
I was wondering if we should also do:
That would mean that if the body isn't present we would correctly send a nil object down to the server implementation but I am concerned that would lead to lots of panics in existing services for users that hadn't been paying attention to the fact that
required: false
is the default behavior when not set.Thoughts?