Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DELETE operations cannot have a requestBody. is inaccurate. #2749

Closed
slacaze opened this issue Jul 26, 2021 · 2 comments
Closed

DELETE operations cannot have a requestBody. is inaccurate. #2749

slacaze opened this issue Jul 26, 2021 · 2 comments

Comments

@slacaze
Copy link

slacaze commented Jul 26, 2021

Q&A (please complete the following information)

  • OS: maxOS
  • Browser: chrome
  • Version: 71
  • Method of installation: https://editor.swagger.io/
  • Swagger-Editor version: unclear (would be nice if the version was shown on the UI
  • Swagger/OpenAPI version: OpenAPI 3.1

Content & configuration

Example Swagger/OpenAPI definition:

openapi: 3.0.0  
info:
  title: I can haz delete with request body
  version: 1.x
paths:
  /test:
    delete:
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object 
      responses:
        '204':
          description: No Content

Describe the bug you're encountering

Semantic error at paths./test.delete.requestBody
DELETE operations cannot have a requestBody.

This is inaccurate, for OpenAPI 3.1.0:

In other cases where the HTTP spec is vague (such as GET, HEAD and DELETE), requestBody is permitted but does not have well-defined semantics and SHOULD be avoided if possible.

I also tried setting:

openapi: 3.1.0

But that did not work.

If this not a bug, and just a case of the 3.1.0 spec not being yet supported, apologies for creating this ticket.

To reproduce...

Steps to reproduce the behavior:

  1. Go to https://editor.swagger.io/
  2. Paste the above YAML

Expected behavior

No error message.

Additional context or thoughts

Cloned and update issue details from #1929 .

@hkosova
Copy link
Contributor

hkosova commented Jul 27, 2021

Your example is openapi: 3.0.0 not 3.1. In 3.0.x, DELETE and GET cannot have requestBody.

OAS 3.1 is not supported yet, this is tracked in #2638.

@hkosova hkosova closed this as completed Jul 27, 2021
@slacaze
Copy link
Author

slacaze commented Jul 27, 2021

That makes sense, apologies for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants