Skip to content

Limitations Array and Object schema limitations #33

@cyberixae

Description

@cyberixae

According to the specification the following schema is supposed match { foo: 'foo' } and any item that is not an object to begin with.

{
  "properties": {
    "foo": { "const": "foo" }
  }
}

In a similar manner the following schema is supposed to match the tuple [ 'bar', 123 ] and any item that is not an array at all.

{
  "items": [
    { "const": "bar" },
    { "const": 123 }
  ]
}

Iotsfjs currently fails to validate these requirements because I haven't been able to find a good way to describe them in the TypeScript's static type system. Essentially they could be described with somethings like { foo: 'foo' } | Not<Record<string, any>> and ['bar', 123] | Not<Array<any>> but TypeScript doesn't provide Not out of box. It might be possible to represent them with conditional types but this gets quite complicated very easily.

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