Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"items" can be a bool in 2020 #49

Closed
chanced opened this issue Nov 20, 2021 · 4 comments
Closed

"items" can be a bool in 2020 #49

chanced opened this issue Nov 20, 2021 · 4 comments
Labels

Comments

@chanced
Copy link

chanced commented Nov 20, 2021

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
}
@chanced
Copy link
Author

chanced commented Nov 20, 2021

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!

@santhosh-tekuri
Copy link
Owner

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 },
}

@chanced
Copy link
Author

chanced commented Nov 20, 2021

Aaaahh, thank you! Sorry for the erroneous ticket!

@chanced chanced closed this as completed Nov 20, 2021
@santhosh-tekuri
Copy link
Owner

It's fine. Not an issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants