Skip to content

terminusdb.yaml fails to validate due to requestBody in DELETE #3

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

Closed
spl opened this issue Feb 2, 2022 · 4 comments · Fixed by #5
Closed

terminusdb.yaml fails to validate due to requestBody in DELETE #3

spl opened this issue Feb 2, 2022 · 4 comments · Fixed by #5

Comments

@spl
Copy link
Contributor

spl commented Feb 2, 2022

The OpenAPI 3.0 specification disallows requestBody in DELETE:

The requestBody is only supported in HTTP methods where the HTTP 1.1 specification (RFC 7231) has explicitly defined semantics for request bodies. In other cases where the HTTP spec is vague, requestBody SHALL be ignored by consumers.

RFC 7231:

A payload within a DELETE request message has no defined semantics; sending a payload body on a DELETE request might cause some existing implementations to reject the request.

This currently causes terminusdb.yaml to fail validation with the Swagger Editor.

Endpoints like /api/db and /api/document support JSON in the DELETE request. I believe the use of the request body is not integral to the semantics of the operation. That is, we could replace the JSON request body with query parameters that serve the same purpose.

The latest release of the OpenAPI specification, v3.1.0, allows requestBody in DELETE:

The requestBody is fully supported in HTTP methods where the HTTP 1.1 specification (RFC 7231) has explicitly defined semantics for request bodies. 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.

However, the Swagger Editor does not yet support OpenAPI 3.1. Also, there aren't many OpenAPI tools that support 3.1.

@GavinMendelGleason
Copy link
Member

Not allowing requestBody in delete was a mistake. We should probably ignore the error if it is possible.

@spl
Copy link
Contributor Author

spl commented Feb 2, 2022

I like valid things, so I would like to have CI to validate terminusdb.yaml; however, it would fail every time. So, would it be better to:

  1. add CI validation and look at the always-failing output for other possible failures or
  2. not have CI validation?

@GavinMendelGleason
Copy link
Member

We should ignore the specific error regarding request body in DELETE if it's not too much trouble. Otherwise get rid of CI validation.

spl added a commit that referenced this issue Feb 3, 2022
* Validate OpenAPI specifications against the Swagger Editor
* Ignoring error: DELETE operations cannot have a requestBody
* Fixes #3
@spl spl closed this as completed in #5 Feb 3, 2022
spl added a commit that referenced this issue Feb 3, 2022
* Validate OpenAPI specifications against the Swagger Editor
* Ignoring error: DELETE operations cannot have a requestBody
* Fixes #3
@spl
Copy link
Contributor Author

spl commented Feb 3, 2022

Thanks to https://github.com/char0n/swagger-editor-validate/pull/126, we can ignore the error! 🎉

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

Successfully merging a pull request may close this issue.

2 participants