-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Description
Q&A (please complete the following information)
- OS: Windows 10
- Browser: Chrome latest
- Method of installation: https://editor.swagger.io, dist assets
- Swagger-UI version: 3.26.0 and later
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
openapi: 3.0.0
info:
title: Form data with required fields
version: 1.0.0
servers:
- url: https://httpbin.org
paths:
/post:
post:
requestBody:
required: true # This doesn't have an impact
content:
application/x-www-form-urlencoded:
schema:
type: object
required: [str, num, bool]
properties:
str:
type: string
num:
type: integer
bool:
type: boolean
responses:
'200':
description: okDescribe the bug you're encountering
If an OAS3 operation uses form data with some required fields, and the field values are left empty, these fields are not included in the request. This is a regression in v. 3.26.0, most likely introduced by PR #5830. In v. 3.25.5, required fields were sent, even with empty values.
This issue is NOT the same as #5181 which is about preventing "try it out" from being executed if the required fields aren't filled.
To reproduce...
Using the API definition above, execute the request with the default values, and examine the cURL command.
Expected behavior
... -d "str=&num=&bool="
That is, all required fields are sent, even with empty values.
Actual behavior
... -d ""
That is, the str, num and bool fields are not sent, even though they are required.
Screenshots
n/a
Additional context or thoughts
n/a