Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
$ref replacement
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Konstantin Käfer  
View profile  
 More options Jun 17 2012, 7:56 am
From: Konstantin Käfer <kkae...@gmail.com>
Date: Sun, 17 Jun 2012 04:56:39 -0700 (PDT)
Local: Sun, Jun 17 2012 7:56 am
Subject: $ref replacement
Hi,

I noticed that in the current revision, 5.28 says about $ref: "it
SHOULD replace the current schema with the schema referenced by the
value's URI".

Let's take this schema (Invoice.json):

{
    "name": "Invoice",
    "type": "object",
    "properties": {
        "id": {
            "type": "integer"
        },
        "delivery": {
            "$ref": "Delivery.json",
            "required": true
        }
    }

}

When truly overwriting the current object, "required" is thrown away.
How can I specify another schema as /required/ without *writing* it
into the other schema's (Delivery.json) root?

Konstantin


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francis Galiegue  
View profile  
 More options Jun 17 2012, 9:38 am
From: Francis Galiegue <fgalie...@gmail.com>
Date: Sun, 17 Jun 2012 15:38:21 +0200
Local: Sun, Jun 17 2012 9:38 am
Subject: Re: [json-schema] $ref replacement

This is one more motivation to change the definition of the "required" keyword!

As was already explained earlier, the "required" keyword has no role
in the schema is it attached to, it only makes sense to its containing
"properties". In draft v4, this keyword will change and your schema
will become:

{
   "name": "Invoice",
   "type": "object",
   "properties": {
       "id": {
           "type": "integer"
       },
       "delivery": {
           "$ref": "Delivery.json"
       }
   },
   "required": [ "delivery" ]

}

Basically, it means that when validating a "properties" schema at the
moment, you have to lookup all "required" keywords in property schemas
to build the list of required properties for an object instance. With
draft v4 it will no longer be the case.

As such, "$ref" replacement doesn't really matter. But "required" as
defined in draft v3 is certainly confusing.

Hope this helps,
--
Francis Galiegue, fgalie...@gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Konstantin Käfer  
View profile  
 More options Jun 18 2012, 6:13 am
From: Konstantin Käfer <kkae...@gmail.com>
Date: Mon, 18 Jun 2012 03:13:18 -0700 (PDT)
Local: Mon, Jun 18 2012 6:13 am
Subject: Re: [json-schema] $ref replacement

Alright, thanks for confirming that I'm not misusing the property but that
it's indeed a flaw in the spec.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Francis Galiegue  
View profile  
 More options Jun 18 2012, 7:37 am
From: Francis Galiegue <fgalie...@gmail.com>
Date: Mon, 18 Jun 2012 13:37:27 +0200
Local: Mon, Jun 18 2012 7:37 am
Subject: Re: [json-schema] $ref replacement

On Mon, Jun 18, 2012 at 12:13 PM, Konstantin Käfer <kkae...@gmail.com> wrote:
> Alright, thanks for confirming that I'm not misusing the property but that
> it's indeed a flaw in the spec.

Not only that, but draft v3 as such does not make any reference to the
JSON Reference spec[1]. It is scheduled for draft v4.

Now, I wish I had completed my work on my own implementation of Json
Schema earlier so that I fulfill a promise I have made earlier on the
list :/

[1] http://tools.ietf.org/html/draft-pbryan-zyp-json-ref-02
--
Francis Galiegue, fgalie...@gmail.com
"It seems obvious [...] that at least some 'business intelligence'
tools invest so much intelligence on the business side that they have
nothing left for generating SQL queries" (Stéphane Faroult, in "The
Art of SQL", ISBN 0-596-00894-5)


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Miles  
View profile  
 More options Jun 19 2012, 6:17 am
From: Chris Miles <ch...@moonfruit.com>
Date: Tue, 19 Jun 2012 11:17:27 +0100
Local: Tues, Jun 19 2012 6:17 am
Subject: Re: [json-schema] $ref replacement
You can do:

{
    "name": "Invoice",
    "type": "object",
    "properties": {
        "id": {
            "type": "integer"
        },
        "delivery": {
            "extends": {"$ref": "Delivery.json"},
            "required": true
        }
    }

}

Chris

On 17/06/12 12:56, Konstantin K fer wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
N. Morse  
View profile  
 More options Jun 19 2012, 12:13 pm
From: "N. Morse" <nmo...@academiccatalog.com>
Date: Tue, 19 Jun 2012 12:13:09 -0400
Local: Tues, Jun 19 2012 12:13 pm
Subject: Re: [json-schema] $ref replacement

@Chris That is the form I would use as well.

--
Nate Morse
Programmer
SmartCatalog
217 Commercial Street, Suite 406
Portland, ME 04101
800 770-8425
207 774-4769
207 780-0129 fax
www.academiccatalog.com

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »