Activitywatch: Generated OpenAPI spec gives $schema errors in the Swagger Editor

Created on 22 Nov 2018  路  11Comments  路  Source: ActivityWatch/activitywatch

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 馃憤

tech debt low stale

Most helpful comment

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

All 11 comments

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.

Hi,

It's not on convert json to yaml:
image

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

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

@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.

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

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.

Still waiting for OpenAPI v3 support in flask-restplus

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ErikBjare picture ErikBjare  路  4Comments

ankushdas9 picture ankushdas9  路  8Comments

alexriabtsev picture alexriabtsev  路  4Comments

ErikBjare picture ErikBjare  路  9Comments

awesomehaze picture awesomehaze  路  9Comments