Skip to content

OpenAPI is a schema, so export to it should permit incomplete values #4243

@fastcat

Description

@fastcat

Is your feature request related to a problem? Please describe.
The OpenAPI schema export seems to mostly require complete values. This means, for example, it is usually not possible to export a schema that contains strings or lists that are required to be non-empty.

For example, if I am describing a configuration with a required field that requires a non-empty value, e.g.:

#Config: {
  values: [string, ...string]
}

This is trivial to express in OpenAPI, but if I try to export it I get this (confusing) error:

components.schemas.Config.properties.values.default.0: incomplete value string

Describe the solution you'd like
Exporting to OpenAPI is creating a schema, not a value, and as such it should not care about incomplete values, only about the schema they must satisfy.

Describe alternatives you've considered
In rare cases providing a default value might make sense.

In some situations making a parent field of the non-empty one optional can work around the issue, but that does not work for the example above.

Generally the only viable workaround seems to be to omit the requirements for minimum lengths of strings & lists, and apply manual validation of the problematic fields elsewhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions