Skip to content

Vocab for combinations of keywords #43

Open
@gregsdennis

Description

@gregsdennis

The keyword set defined by the core vocabs can do lots of things, but sometimes those things are difficult or cumbersome to represent.

I'd like to propose a combinatorics vocab that defines keywords that represent combinations of applicators.

For example, if you wanted to require any of a number of properties, you currently have to do

{
  "anyOf": [
    { "required": [ "foo" ] },
    { "required": [ "bar" ] },
    { "required": [ "baz" ] },
    { "required": [ "qux" ] },
    { "required": [ "quux" ] },
    { "required": [ "quuz" ] }
  ]
}

or maybe (though it's not quite the same thing because the above also allows additional properties)

{
  "properties": {
    "foo": true,
    "bar": true,
    "baz": true,
    "qux": true,
    "quux": true,
    "quuz": true
  },
  "additionalProperties": false,
  "minProperties": 1
}

But the vocab could define a single keyword, e.g. anyOfRequired that does this much more simply

{
  "anyOfRequired": [ "foo", "bar", "baz", "qux", "quux", "quuz" ]
}

This vocab would be full of odds and ends like this.

A lot of keyword requests are about making things like this easier, so maybe we just have an evolving vocab to contain these "refactor" keywords.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions