-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Description
Q&A
- OS: Windows
- Browser: chrome
- Version: 89.0.4389.128
- Swagger-UI version: https://editor.swagger.io/
- Swagger/OpenAPI version: Swagger 2.0
Content & configuration
Example Swagger/OpenAPI definition:
swagger: '2.0'
info:
title: swashbuckletest
version: v1
paths:
/WeatherForecast:
put:
tags:
- WeatherForecast
consumes:
- application/json
- text/json
- application/*+json
parameters:
- in: body
name: body
schema:
$ref: '#/definitions/TopModel'
responses:
'200':
description: Success
definitions:
NestedModel:
required:
- id
type: object
properties:
id:
type: string
TopModel:
type: object
properties:
nested:
$ref: '#/definitions/NestedModel'Swagger-UI configuration options:
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "swashbuckletest v1"));Describe the bug you're encountering
PUT endpoint uses "TopModel" as input model and inside it there is an optional "nested" field of type "NestedModel".
"nested" object has a required "Id" field. Swagger UI doesn't allow to execute the request without "nested" field.
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor.swagger.io/
- Click on 'File' -> 'Import file' and pick the YAML (see above)
- Expand
PUT /WeatherForecast, click 'Try out' - Replace 'body' with
{}(empty object) - Click 'Execute' button - no request were made
Expected behavior
In previous versions we could have omitted an optional object. So the body input {} should be considered as valid in this case.
dario-hd
Metadata
Metadata
Assignees
Labels
No labels