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

response schema of "file" is not valid in OpenApi v3 #2016

Closed
AnthonySteele opened this issue Mar 12, 2019 · 3 comments
Closed

response schema of "file" is not valid in OpenApi v3 #2016

AnthonySteele opened this issue Mar 12, 2019 · 3 comments

Comments

@AnthonySteele
Copy link

AnthonySteele commented Mar 12, 2019

We have an endpoint that NSwag is generating schema like this for:

"responses": {
          "200": {
            "description": "",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "file"
                }
              }
            }
          }

The method signature is

[HttpPost]
public async Task<IHttpActionResult> Callback(
    string trackingId, [FromBody] CallbackRequest body)

According to speccy and the spec here, the "type": "file" is not valid. The type should be string.

Speccy gives error:

Specification schema is invalid.

expected 'file' to be equals one of Array [ 'integer', 'number', 'string', 'boolean', 'object', 'array' ]
@RicoSuter
Copy link
Owner

Thanks for reporting, should be high prio and easy to fix

@RicoSuter
Copy link
Owner

Will be in v12.0.16 soon

@AnthonySteele
Copy link
Author

The "workaround" is to do what you should do anyway, and add some metadata to the action method, e.g.

[SwaggerResponse(HttpStatusCode.OK, typeof(void))]
[SwaggerResponse(HttpStatusCode.BadRequest, typeof(string))]

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

No branches or pull requests

2 participants