Skip to content

ENUM for $expand, $select, and $orderby is too restrictive #38

Description

@snebjorn

According to OAS 3

Enums
You can use the enum keyword to specify possible values of a request parameter or a model property.

I believe possible values means that the ENUM values are the only valid values.

Currently this schema is generated for $expand, $select, and $orderby

{
  "schema": {
    "type": "array",
    "uniqueItems": true,
    "items": {
      "type": "string",
      "enum": ["foo", "bar", "baz"]
    }
  }
}

I like to suggest this instead

{
  "schema": {
    "type": "array",
    "uniqueItems": true,
    "items": {
      "anyOf": [
        {
          "type": "string",
          "enum": ["foo", "bar", "baz"]
        },
        {
          "type": "string"
        }
      ]
    }
  }
}

This would allow tooling to suggest values while also accepting free form text.
I didn't reason about if using oneOf is more correct then anyOf.

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