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

Using empty schema object does not work anymore #452

Closed
micovery opened this issue Aug 29, 2015 · 4 comments · Fixed by #474
Closed

Using empty schema object does not work anymore #452

micovery opened this issue Aug 29, 2015 · 4 comments · Fixed by #474

Comments

@micovery
Copy link

Since this change,

9db746f

It's not possible anymore to specify an empty schema object in a response.

{ }

I believe this is because of the "oneOf" operator:

"oneOf": [
            {
              "$ref": "#/definitions/schema"
            },
            {
              "$ref": "#/definitions/fileSchema"
            }
          ]

since { } matches both schemas ... it fails validation.

A simple fix for this I think is to make the "type" field required for "#/definitions/fileSchema"

@webron
Copy link
Member

webron commented Aug 29, 2015

Thanks for reporting, I'll get it fixed. Do you experience the problem with any specific tool?

@micovery
Copy link
Author

I see it as a validation error when using editor.swagger.io.

image

---
swagger: "2.0"
info:
  title: "Sample"
  version: "1.0.0"
basePath: "/sample"
paths:
  /test:
    get:
      summary: "Test API"
      description: Test API"
      responses:
        200:
          schema: { }
          description: "Operation Successful"

@webron
Copy link
Member

webron commented Aug 29, 2015

Okay thanks. Keep in mind it'll take a bit for the fix to be included in the editor.

In general, we don't recommend using an empty schema, however it is valid.

@achew22
Copy link

achew22 commented Dec 27, 2015

This doesn't seem to be fixed on http://editor.swagger.io on Sunday December 27th 2015. Is that working as intended? Using the same code sample referenced above.

achew22 added a commit to achew22/grpc-gateway that referenced this issue Jan 9, 2016
If properties are always included then the parser will be happy even if
properties is an empty list.
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.

3 participants