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

The unevaluatedItems lesson needs work #61

Open
jdesrosiers opened this issue Aug 14, 2024 · 0 comments
Open

The unevaluatedItems lesson needs work #61

jdesrosiers opened this issue Aug 14, 2024 · 0 comments
Labels
📝 Documentation Improvements or additions to documentation

Comments

@jdesrosiers
Copy link
Member

The unevaluatedItems lesson is a lesson for items, not unevaluatedItems. While you can use unevaluatedItems in place of items and get the same result, this lesson does nothing to show an actual use case for the keyword. Notice that this passes the lesson.

{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "age": {
      "type": "integer"
    },
    "skills": {
      "type": "array",
      "prefixItems": [
        { "enum": ["HTML", "CSS", "JavaScript"] },
        { "enum": ["HTML", "CSS", "JavaScript"] },
        { "enum": ["HTML", "CSS", "JavaScript"] }
      ],
      "items": { "type": "string" }
    }
  }
}

A lesson on unevaluatedItems should include extending and/or closing a tuple using an applicator of some kind. Here's an example of adding an item to the tuple and closing it to further extension.

{
  "$ref": "#/$defs/tuple",
  "prefixItems": [true, true, { "type": "number" }],
  "unevaluatedItems": false,

  "$defs": {
    "tuple": {
      "type": "array",
      "prefixItems": [
        "type": "string",
        "type": "boolean"
      ]
    }
  }
}
@JeelRajodiya JeelRajodiya added the 📝 Documentation Improvements or additions to documentation label Aug 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📝 Documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants