Chris
> --
> You received this message because you are subscribed to the Google
> Groups "JSON Schema" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/json-schema/-/cf1TRAmM3IsJ.
> To post to this group, send email to json-...@googlegroups.com.
> To unsubscribe from this group, send email to
> json-schema...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/json-schema?hl=en.
I think you misunderstood my point. What I would like to specify something like this:
"properties": {
"property1": {
"type": "boolean",
"value": "true"
}
}
In other words, the only valid instances of this schema must have:
{
"property1": true
}
But because there is no such schema property as "value", I use the following instead:
"properties": {
"property1": {
"type": "boolean",
"enum": ["true"]
}
}
Which is less elegant (IMHO). My analogy was to the following:
int main(void){
int x = 5;
printf("%d", x);
return 0;
}
vs.
int[] main(void){
int x[1] = {5};
printf("%d", x[0]);
return {0};
}
It isn't a perfect analogy, but I think it illustrates that sufficiency does not imply elegance.
Thanks,
Mike
This has already been discussed. I have also proposed "value" but it
has been deemed counterproductive.
I also use "value" in my slightly modified JSON Schema to "prefill" values in the model when having undefined data, but a defined "value" in the JSON schema. Useful when you want to create new objects with JSON Schema acting as a template. So in this case it acts like a kind of default. Also in this case, parsing "enum" would be a bit more complex.
The "const" property was added in draft-wright-json-schema- validation-01 (a.k.a. draft-06)