-
-
Notifications
You must be signed in to change notification settings - Fork 313
dynamic enum on object's arbitrary key names? #869
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
Comments
The general form of this question is being tracked in #855. It's one of the more controversial topics remaining in JSON Schema, so don't expect a quick or easy answer. |
Yes, I'm aware of #855 but my intent was precisely to create a narrower scope for the following reasons, neither of which can generally be said to hold true for the broader scope of #855:
|
Where did you get that understanding from? It's totally valid, and expected, to allow There are plenty of constructs of a JSON Schema which are valid but sensless or not useful, but it's impossible (I'd take an educated guess at this) to define them all, let alone constrain them all. It's possible to create a JSON Schema which doesn't make any sense but is still valid. It's possible to combine schemas in a way which breaks expectations. It sounds like what you want is a linter, not a validator. JSON Schema itself is not a linter. One is planned, but it's unlikely to be soon. You can check out an existing linter here: https://www.json-schema-linter.com/ |
Ah, thank you! I just assumed that anything in |
Below is an example JSON Schema:
Suppose we wanted to describe the schema of JSON Schema using JSON Schema. How would we describe the requirements that "required" can only contain values that exist as keys to "properties"?
This is the similar to (but not the same as) the questions posted at https://stackoverflow.com/questions/57556768/use-object-keys-as-type-in-json-schema and #855.
The text was updated successfully, but these errors were encountered: