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

Support for request body with arbitrary Content-Type (OpenAPI.Next) #882

Closed
lucafavatella opened this issue Feb 7, 2017 · 3 comments
Closed

Comments

@lucafavatella
Copy link

When attempting to describe a PUT request with arbitrary request body and Content-Type (think about a file upload server where you can choose the Content-Type), a "default" catch-all Content-Type needs to be added to content object.

I understand that request with arbitrary body and Content-Type cannot be specified in OpenAPI 2.0 (file type has restrictions on Content-Type).

@webron
Copy link
Member

webron commented Feb 7, 2017

This has been resolved in #878.

@webron webron closed this as completed Feb 7, 2017
@lucafavatella
Copy link
Author

I see an example of request body in https://github.com/OAI/OpenAPI-Specification/blob/17a389a2e3150c3b10a105e461b73666b2e560e0/versions/3.0.md#requestBodyObject has a "*" section that looks what I wanted. Thanks.

{
  "description": "user to add to the system",
  "content" : {
    "application/json" : {
      "schema": {
          "$ref": "#/definitions/User"
        },
      "examples": [
        { "$ref": 'http://foo.bar#/examples/address-example.json'}
      ]
    },
...
    "*": {
      "example": {
        $ref: "http://foo.bar#/examples/address-example.whatever"
      }
  }
}

@webron
Copy link
Member

webron commented Feb 8, 2017

The example should actually be */* but, the idea is the same.

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