Skip to content

Generated OpenAPI spec gives $schema errors in the Swagger Editor #252

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
OlivierMary opened this issue Nov 22, 2018 · 11 comments
Closed

Generated OpenAPI spec gives $schema errors in the Swagger Editor #252

OlivierMary opened this issue Nov 22, 2018 · 11 comments

Comments

@OlivierMary
Copy link

Hi,

Somes returns on http://localhost:5600/api/swagger.json

swagger.json isn't valid -> put it in https://editor.swagger.io/ to see error:

image

Maybe set an abstract type for event.data or a type including all possibles fields?

in any case thanks for the swagger 👍

@johan-bjareholt
Copy link
Member

I went ahead and tried to find the issue and found this schema for event

https://github.com/ActivityWatch/aw-server/blob/master/aw_server/rest.py#L57

Seems to be correct, so I also tested the swagger editor which you used. Apparently it for some reason adds this $schema property when converting from JSON to YAML, so it seems like this is simply an issue with the swagger editor actually. If you simply remove that added property it no longer complains.

@OlivierMary
Copy link
Author

Hi,

It's not on convert json to yaml:
image

@OlivierMary
Copy link
Author

@johan-bjareholt
Copy link
Member

Oh, you are correct, just got confused when it was reordered.

I see this TOTO https://github.com/ActivityWatch/aw-server/blob/master/aw_server/rest.py#L60

That's not related to this issue, shouldn't impact.

Care another json contains this $schema https://github.com/ActivityWatch/aw-core/search?q=http%3A%2F%2Fjson-schema.org%2Fdraft-04%2Fschema&unscoped_q=http%3A%2F%2Fjson-schema.org%2Fdraft-04%2Fschema

Good catch.

I still don't understand why Swagger editor is complaining though, it is a valid property as far as I understand.

https://json-schema.org/latest/json-schema-core.html#rfc.section.7

@OlivierMary
Copy link
Author

It's valid for a json-schema, not valid for swagger generator: https://swagger.io/docs/specification/data-models/keywords/ #Unsupported Keywords

@johan-bjareholt
Copy link
Member

@OlivierMary But in that case, why does it give an error about it and not just simply ignore it?
Doesn't seem like it should break anything.

@ErikBjare
Copy link
Member

This is related to the new OpenAPI v3 spec that isn't supported by flask-restplus yet, see: noirbizarre/flask-restplus#518

@ErikBjare ErikBjare changed the title Somes returns on Swagger Generated OpenAPI spec gives $schema errors in the Swagger Editor Nov 26, 2018
@stale
Copy link

stale bot commented Feb 15, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the !wontfix label Feb 15, 2020
@ErikBjare
Copy link
Member

Still waiting for OpenAPI v3 support in flask-restplus

@stale
Copy link

stale bot commented Aug 13, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 13, 2020
@stale stale bot closed this as completed Aug 27, 2020
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

3 participants