On Sat, Jan 17, 2015 at 6:43 AM, Austin Wright
<
diamon...@users.sourceforge.net> wrote:
[...@
>
>>
>> JSON Schema is not an ORM description language... Also, you will
>> actually never process such a schema since implementations would be
>> required to expand before processing the schema.
>
>
> That's exactly what it is. It's describing the structure of data.
>
No, it isn't. Look again.
> Some people use it to validate instances
>
Yes.
> Some people use it to extract link relations
>
Yes.
> Some people use it to generate forms
>
Yes.
> Some people use it to structure data storage.
>
But no. You MAY use JSON Schema for that, but HOW you do it is none of
JSON Schema's concern. If for a same schema you use a plain text file
to store the data, or an SQL database with joins on 4 tables, or a
Cassandra storage, or HDFS or whatever, JSON Schema doesn't give a
<beep>.
JSON Schema is not an ORM description language.
[...]
>>
>> > Suppose I want to say "Only validate one property of this instance using
>> > that schema over there" - merge/patch not only loses all semantic
>> > meaning,
>> > but it's simply incapable of solving this problem altogether.
>> >
>>
>> Good -- since JSON Schema is not meant for such things.
>
>
> Yes it is. Quoth draft-4:
>
> JSON Schema defines the media type "application/schema+json", a JSON based
> format for defining the structure of JSON data. JSON Schema provides a
> contract for what JSON data is required for a given application and how to
> interact with it. JSON Schema is intended to define validation,
> documentation, hyperlink navigation, and interaction control of JSON data.
>
>
> I'd think that pretty clearly covers the case I posted about.
>
No. See above.
[...]
>>
>> It is just meant to allow schema reuse in a MUCH more efficient manner
>> than anything existing. Without breaking backwards compatibility,
>> basing itself on standards etc.
>>
>> Also, if you use RFC 6902, you even have a "test" operation; which
>> means you can make expansion fail if some field in the source schema
>> you want to extend isn't what you expect it to be anymore!
>
>
> Your $patch/$merge is currently defined as a preprocessing step, before it
> hits the validator proper (including "test"). If you're proposing a change
> to these semantics, could you define it please?
>
It was defined in the pages I had about them, quite some time ago, but
since it didn't make it in the official list of changes these got
lost.
But that's how it is. The order of processing is, in order:
* JSON Reference,
* $merge or $patch.
It is ILLEGAL to have both $merge and $patch at the same time.