Mark upload request bodies required from policy #6

Merged
stephen merged 1 commit from feat/requestbody-required-overrides into main 2026-09-11 19:14:25 +00:00
Owner

swift-openapi-generator does not emit an optional multipart request body at all. It warns ("Multipart request bodies must always be required, but found an optional one - skipping") and generates the operation with no body parameter, so an upload endpoint ends up present in the client and impossible to call.

Upstream leaves repoCreateReleaseAttachment's body unmarked, which is why Fjord has no way to attach a file to a release today. Rather than hand-editing the vendored spec, this adds a second policy-driven patch pass next to the existing requiredOverrides one: requestBodyOverrides names the operations whose request body has to be marked required, and make patch runs the two passes in sequence.

The new script validates each entry against the spec, so an operation that is missing or has no request body fails at patch time instead of quietly patching nothing. make check-patched is green and the pass is idempotent.

swift-openapi-generator does not emit an optional multipart request body at all. It warns ("Multipart request bodies must always be required, but found an optional one - skipping") and generates the operation with no body parameter, so an upload endpoint ends up present in the client and impossible to call. Upstream leaves `repoCreateReleaseAttachment`'s body unmarked, which is why Fjord has no way to attach a file to a release today. Rather than hand-editing the vendored spec, this adds a second policy-driven patch pass next to the existing `requiredOverrides` one: `requestBodyOverrides` names the operations whose request body has to be marked required, and `make patch` runs the two passes in sequence. The new script validates each entry against the spec, so an operation that is missing or has no request body fails at patch time instead of quietly patching nothing. `make check-patched` is green and the pass is idempotent.
Mark upload request bodies required from policy
All checks were successful
CI / Contract drift (pull_request) Successful in 7s
83af9a70f3
swift-openapi-generator does not emit an optional multipart request body at
all. It warns ("Multipart request bodies must always be required, but found
an optional one - skipping") and generates the operation with no body
parameter, which leaves an upload endpoint present in the client and
impossible to call.

Upstream leaves repoCreateReleaseAttachment's body unmarked, so the Swift
client had no way to attach a file to a release. Rather than hand-editing the
vendored spec, this adds a second policy-driven patch pass alongside the
existing requiredOverrides one: requestBodyOverrides names the operations
whose request body has to be marked required, and the patch target runs both
passes in sequence.

The script fails when an entry names an operation that is missing or has no
request body, so a stale entry surfaces at patch time rather than silently
patching nothing.
stephen deleted branch feat/requestbody-required-overrides 2026-09-11 19:14:25 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rasterstate/forgejo-api-contract!6
No description provided.