swagger-api / swagger-api/swagger-editor
Provide a way to optionally not send a request body if optional
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 9.5k
- Forks
- 2.4k
- Avg merge
- 17h 15m
- Merged PRs (30d)
- 18
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the request in Swagger Editor using the optional OpenAPI requestBody shown in the issue, then trace the request-body editor and generated request behavior. Done means the UI provides an enabled-by-default way to omit the body and sends no request body when disabled; add or update coverage for both states if the relevant tests are found.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api, frontend
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100