santhosh-tekuri/jsonschema

`"items"` can be a `bool` in 2020

Closed this issue · 4 comments

see the Closed tuple example in the 2020 release notes https://json-schema.org/draft/2020-12/release-notes.html

{
  "prefixItems": [
    { "$ref": "#/$defs/foo" },
    { "$ref": "#/$defs/bar" }
  ],
  "items": false
}

Also, thanks for the awesome package.

In addition to the functionality your package provides, I need to be able to simply marshal/unmarshal into json/yaml. That alone has been a nontrivial lift. My point is, much respect for getting compilation/validation working!

yes. in 2020 release, items can take boolean value.
but in 2020 release, boolean value is a valid schema.

so in 2020 release, items is compiled into boolean schema if it is boolean.

to be precise:

{ "items": false }

compiles into:

&Schema{
    Items2020: &Schema{ Always: &false },
}

similarly:

{ "items": true }

compiles into:

&Schema{
    Items2020: &Schema{ Always: &true },
}

Aaaahh, thank you! Sorry for the erroneous ticket!

It's fine. Not an issue