fix: respect requestBody.required in strict server
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:
var body *{{$opid}}{{.NameTag}}RequestBody
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?
any update on this PR? thanks!
Kusari Analysis Results
Analysis for commit: 6225e75bb76ba1fa15113a7fc6aace55ad12862c, performed at: 2025-08-01T08:12:45Z
• @kusari-inspector rerun - Trigger a re-analysis of this PR
• @kusari-inspector feedback [your message] - Send feedback to our AI and team
Recommendation
✅ PROCEED with this Pull Request
Summary
✅ No Flagged Issues Detected
All values appear to be within acceptable risk parameters.
No pinned version dependency changes, code issues or exposed secrets detected!
Found this helpful? Give it a 👍 or 👎 reaction!
We also need this fix to support required: false request bodies being generated. Up