-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Description
When validation.request: true is set on the openapi module, request validation for operations with application/x-www-form-urlencoded content type fails with:
{"error":"request validation failed","errors":["request body contains invalid JSON: invalid character 'B' looking for beginning of value"]}The validator attempts to parse the form-encoded body as JSON, ignoring the Content-Type header and the spec's declared content type.
Reproduce:
- Define an operation with
application/x-www-form-urlencodedrequest body in the spec - Enable
validation.request: trueon the openapi module - Send a form-encoded POST request to the operation's path
- Observe: validation rejects the request with "invalid JSON" error
- Expected: validation should parse and validate form-encoded bodies correctly, or skip validation for non-JSON content types
Workaround: Remove requestBody from the spec for form-encoded operations. The pipeline can still parse the body via step.request_parse with parse_body: true.
Spec example:
/webhook:
post:
operationId: receiveWebhook
x-pipeline: handle-webhook
requestBody:
required: true
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
Body:
type: string
From:
type: stringReactions are currently unavailable