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

Revise 405 Response Object description to follow the RFC7231 Specification 's definition #1486

Merged
merged 1 commit into from
Feb 13, 2018

Conversation

weimengxi
Copy link

As the document says, the key of a responses object's Patterned Fields is Http Status Code .

and the document gives responses object examples like this at following part.

  "responses": {
    "405": {
      "description": "Invalid input",
      "content": {
        "application/json": {},
        "application/xml": {}
      }
    }
  }

As it defined in rfc7231 Specification , 405 indicates Method Not Allowed rather than Invalid Input .

The 405 (Method Not Allowed) status code indicates that the method
received in the request-line is known by the origin server but not
supported by the target resource.

I think we'd better follow the rfc7231 Specification 's definition

#1449

@weimengxi weimengxi changed the title Revise 405 Response Object description to follow the rfc7231 Specification 's definition Revise 405 Response Object description to follow the RFC7231 Specification 's definition Feb 11, 2018
@weimengxi
Copy link
Author

hi @MikeRalphson, sorry to disturb you again ~

@MikeRalphson
Copy link
Member

Not at all, @weimengxi thank you for resubmitting. Looks good now. Just needs another reviewer to sign off.

@webron
Copy link
Member

webron commented Feb 12, 2018

@MikeRalphson here you go.

@pleothaud
Copy link

Hi there, it seems that there is a underlying problem here: as responses ca only be defined for an operation (an accepted method on a specific path) defining a 405 "Method not allowed" response makes no sense, as you're just writing that you accept this method (by exposing it in the OAI Spec file)

IMHO the only place holder to define the 405 response would be at the path level, but that's a huge change.

@MikeRalphson
Copy link
Member

MikeRalphson commented Oct 9, 2018

What if the method is not allowed for some users, but is for others?

@darrelmiller
Copy link
Member

What @MikeRalphson said, and....

The allowed methods are dynamic over the lifetime of a resource. That's why OPTIONS returns an Allow header. Something that may be initially updatable, may at some time later be read-only. Also, paths are templated and therefore some resources under the path may support one set of methods and other resources may support a different set of methods.

@pleothaud
Copy link

HI Mike, Darrel,

You're damn right! Sorry, working ATM on a product that must filter out what the backend sends back and validate that it cnforms to what's in the OAI Spec file and I was just wondering how you could specify a 405 for a method that is not authorized in any context...

All in all all what I've got to do is define only a 405 response for this method and voila.

Sorry again!

rstular added a commit to rstular/swagger-editor that referenced this pull request Dec 4, 2023
The petstore YAML is not consistent with the OpenAPI schema 3.0.2 and 3.0.3 as it uses HTTP response code 405 incorrectly (OAI/OpenAPI-Specification#1486)
rstular added a commit to rstular/swagger-editor that referenced this pull request Dec 22, 2023
The petstore YAML is not consistent with the OpenAPI schema 3.0.2 and 3.0.3 as it uses HTTP response code 405 incorrectly (OAI/OpenAPI-Specification#1486)
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 this pull request may close these issues.

None yet

5 participants