swagger-editor
swagger-editor copied to clipboard
Provide a way to optionally not send a request body if optional
Content & configuration
Swagger/OpenAPI definition:
openapi: 3.1.0
info:
title: One game API
version: "1.0"
servers:
- url: http://127.0.0.1:8000
description: Local development server
components:
schemas:
LoginAuthCreateQueryV2:
$id: https://onegame.schemas/api/v2/auth/login-auth-create-query.json
title: LoginAuthCreateQueryV2
type: object
additionalProperties: false
properties:
email:
type: string
kind:
const: login
type: string
password:
type: string
required:
- email
- kind
- password
AuthV2:
$id: https://onegame.schemas/api/v2/auth/auth.json
title: AuthV2
type: object
additionalProperties: false
properties:
accessToken:
type: string
refreshToken:
type: string
required:
- accessToken
- refreshToken
paths:
/v2/auth:
post:
summary: Create an authorization token
operationId: createAuthV2
requestBody:
content:
application/json:
schema:
$ref: https://onegame.schemas/api/v2/auth/login-auth-create-query.json
required: false
responses:
"200":
description: Authorization token created
content:
application/json:
schema:
$ref: https://onegame.schemas/api/v2/auth/auth.json
tags:
- Auth
tags:
- name: Auth
description: Authorization management operations
Swagger-Editor configuration options:
// Not relevant
Is your feature request related to a problem?
There doesn't seem to be a way to avoid sending a request body in case it's optional.
Describe the solution you'd like
I would love to have a way to disable the request body field in order to not to send it when the request body is optional. Maybe a check box could be added (enabled by default) so clicking it would disable the textarea. No body would be sent in this case.
Describe alternatives you've considered
Almost any other way to allow not no send a request body in case an endpoint has an optional request body would be good enough.
Additional context
https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#request-body-object