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

Use $ref instead of allOf for Extending Closed Schemas #65

Open
jdesrosiers opened this issue Aug 14, 2024 · 2 comments · May be fixed by #117
Open

Use $ref instead of allOf for Extending Closed Schemas #65

jdesrosiers opened this issue Aug 14, 2024 · 2 comments · May be fixed by #117
Assignees
Labels
📝 Documentation Improvements or additions to documentation Status: Available No one has claimed responsibility for resolving this issue.

Comments

@jdesrosiers
Copy link
Member

jdesrosiers commented Aug 14, 2024

Lesson Link: https://tour.json-schema.org/content/07-Miscellaneous/01-Extending-Closed-Schemas-with-unevaluatedProperties

The "Extending Closed Schemas" lesson uses allOf for the example, which is fine, but it's not a normal case. In a previous lesson, you specify that you've make available a schema with a certain URI that you want the user to reference. This would be a great time to employ that technique. You provide an address schema at https://example.com/address and then have then extend it by adding the type property.

{
  "$ref": "https://example.com/address",
  "properties": {
    "type": { "enum": [ "residential", "business" ] }
  },
  "unevaluatedProperties": false,
  "required": ["type"]
}

This is a much more realistic way to show what this keyword is good for.

(Also, I think the unevaluatedItems should look a lot like this lesson except for arrays instead of objects.)

@JeelRajodiya JeelRajodiya added the 📝 Documentation Improvements or additions to documentation label Aug 25, 2024
@JeelRajodiya JeelRajodiya added the Status: Available No one has claimed responsibility for resolving this issue. label Sep 29, 2024
@29deepanshutyagi
Copy link

Hi, I'd like to work on this issue. Could you please assign it to me? @JeelRajodiya

Thank you!

@JeelRajodiya
Copy link
Member

Sure @29deepanshutyagi, Please go ahead. Looking forward to receive your PR.

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 Status: Available No one has claimed responsibility for resolving this issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants