Closed preaction closed 3 years ago
The position I'm taking currently on array-of-types is that regardless of what swagger.io says, the JSON schema for OpenAPI 2 allows type to be an array. I recall we chatted on IRC about this, and this is a change from that.
What are your thoughts?
The bigger problem is, I think, that while the Perl JSON::Validator / Mojolicious::Plugin::OpenAPI modules allow type: [ ... ]
in OpenAPI specs, other tools may not.
Except, I think you're right: The OpenAPI spec specifically allows it. Here's the definition of the "schema" property and here's the line in the schema property that says it supports JSON schema's types.
But, all of the parameters
except body parameters ("in": "header"
, "in": "query"
, "in": "formData"
, and "in": "path"
, the ones that do not have a schema
property) do not support array-types. So that's where we would need to pick the first one instead of allowing any.
The OpenAPI code has moved to Yancy::Plugin::OpenAPI, so there's no need to do anything additional here in Yancy.
Continued from #38: The
types
in JSON schema can be an array. Yancy uses this to allow properties to benull
. However, OpenAPI does not allow this (either in v2 or v3). In v3, OpenAPI adds anullable
property, but in v2 all properties are assumed to be nullable unlessrequired
.The Yancy
collections
configuration (and through it, theread_schema
schemas) are JSON schemas. The Yancy editor works with OpenAPI schemas, not JSON schemas. To fix this problem, Yancy will need to translated the JSON schemas to OpenAPI schemas when building the editor's OpenAPI schema.We also need to make sure the documentation is clear:
read_schema
andcollections
are JSON schema (and what version we support),openapi
and the editor are OpenAPI (and what version we support).