Closed mario-minati closed 5 years ago
The refs can be fixed by changing the $
to %24
yes.
The type: [ ... ]
is valid for JSON schema but not OpenAPI, and will need to be translated to OpenAPI (Yancy uses JSON schema, which I thought was compatible...). Except, OpenAPI 2.0 doesn't even support null
as a type, so this is completely wrong. OpenAPI 3.0 supports nullable: true
, but Mojolicious::Plugin::OpenAPI doesn't support OpenAPI 3.0. So I'm not sure what to do here except to remove the array while creating the OpenAPI schema, and then use the tests to find the problems that result...
I guess we have to live with the type: [ ... ]
problem as long as final OpenAPI 3.0 spec is not here.
No, I still think the correct way forward is to consider collections
as JSON schema (which will make more sense when it's renamed schema
in v2), and do some translating into a proper OpenAPI spec as necessary. I'll fix the URL encoding and make a new ticket with a path forward for that part.
Ok, great 👍
Just to link up all the issues and suchlike: #59 adds a private bit of code _openapi_spec_from_schema
that converts between the two spec types. It has a bit of currently-commented code to de-array any array types. My rationale for leaving it commented is that the JSON schema for OpenAPI 2 (unlike swagger.io, and the human-readable spec) actually allows array types. If we want to uncomment the code, obviously that will be super-easy.
I copied the generated api spec (/yanya/api) into Swagger online editor and go some errors:
The generated spec looks like this:
Especially the unescaped
$limit
and thelike looks like a yancy bug?