-
-
Notifications
You must be signed in to change notification settings - Fork 224
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
cookbook page, with solutions to frequently asked questions #190
Comments
I love this. I've been talking with @Relequestual about improving JSON Schema's documentation and content like this is part of the long term plan. Ideally, I'd like to start with minimal updates to Understanding JSON Schema to bring it up to the latest draft. Then get a new website designed and built and port UJS content over. Then do more in-depth documentation plus cookbook, tutorials, and even blogs. Of course that's all very ambitious, so it's great that you're getting the cookbook content rolling. I'm bookmarking this issue to add to when things occur to me. |
The "simulate OpenAPI's |
Cookbook idea: Equivalent of "not": {
"items": {
"not": { ... schema ... }
}
}
Full example {
"type": "array",
"allOf": [{ "$ref": "/#definitions/contains-foo" }],
"definitions": {
"contains-foo": {
"not": {
"items": {
"not": { "$ref": "#/definitions/foo" }
}
}
},
"foo": { "const": "foo" }
}
} |
Cookbook idea: Pattern "not": {
"additionalItems": {
"not": { ... schema ... }
}
} Full example {
"type": "object",
"allOf": [{ "$ref": "/#definitions/contains-foo" }],
"definitions": {
"contains-foo": {
"not": {
"additionalProperties": {
"not": { "$ref": "#/definitions/foo" }
}
}
},
"foo": { "const": "foo" }
}
} |
Cookbook idea: The "Implication Pattern" ( Pattern: Equivalent to "anyOf": [
{ "not": { ... if schema ... } },
{ ... then schema ... }
] Full Example {
"type": "object",
"properties": {
"foo": { "type": "string" },
"bar": { "type": "number" }
},
"allOf": [{ "$ref": "foo-bar-implies-bar-is-required" }],
"definitions": {
"foo-bar-implies-bar-is-required": {
"anyOf": [
{
"not": {
"properties": {
"foo": { "const": "bar" }
},
"required": ["foo"]
}
},
{ "required": ["bar"] }
]
}
}
} |
require propertyA OR propertyB, but not both:
|
The |
Cookbook idea: Multiple fields required as a unit. "foo" and "bar" must both be present or neither
"foo", "bar", "baz", and "quux" must all be present or none at all
|
Cute! a little confusing though! I've done this in the past:
|
How do I validate deep nested data when I don't know where it is in the structure? https://stackoverflow.com/a/67315446/89211
|
Added to the docs strategy issue: #158 |
How to manage schema versioning? |
Hi @benjagm |
@Akshaybagai52 This is not an easy issue. We should start with PR including just some FAQ. I'd love this to be totally data driven. This means a json file in the data folder with the questions and answers so the page is just rendering whatever is in the json. Both fields allowing markdown. Thoughts? |
Thanks for assigning this issue. Just gone through all the chat and will create a PR which contains FAQ in json format with all the markdown as discussed above. |
Can you please change the target branch to https://github.com/json-schema-org/website/tree/web-release-3? |
Hey @benjagm, |
continue in this PR #534 |
Hello! 👋 This issue has been automatically marked as stale due to inactivity 😴 It will be closed in 180 days if no further activity occurs. To keep it active, please add a comment with more details. There can be many reasons why a specific issue has no activity. The most probable cause is a lack of time, not a lack of interest. Let us figure out together how to push this issue forward. Connect with us through our slack channel : https://json-schema.org/slack Thank you for your patience ❤️ |
I am opening this as an issue rather than a PR to start, in order to gather feedback and additional content.
There are a number of questions that are asked frequently on stackoverflow, slack, github issues etc that come down to "how do I express this pattern in JSON Schema?" Here are a few of them, and I'm sure we can come up with more:
"evaluate this subschema but do not collect annotations" (not so common but it has come up a few times, and it is weird enough that it deserves a mention IMO):
{ not: { not: { ... subschema ... } } }
add descriptions to a bunch of enum values, e.g. for form generation:
The text was updated successfully, but these errors were encountered: