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
Questions about default
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
  3 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
 
villard1...@gmail.com  
View profile  
 More options Oct 18 2012, 10:50 am
From: villard1...@gmail.com
Date: Thu, 18 Oct 2012 07:50:50 -0700 (PDT)
Local: Thurs, Oct 18 2012 10:50 am
Subject: Questions about default

The specifications (v3 and v4) are quite terse on describing the semantic
of 'default'. In particular they don't address the following issues:
- The spec v4 says "This keyword can be used to substitute a default value
for the production of a user interface.". First, it seems quite
restrictive. Second, does that imply the input JSON is augmented with
default values by the validator (similar to what XML schema validators do)?
- There are many cases where the use of default produces unpredictable
output. For instance (using v3 syntax):

   { "type": [  { "default": { "a":"a" } }, { "default": { "b":"b" } } ] }

Which of the 2 default values should be taken?

It seems to me 'default' is really underspecified and does not address edge
cases.


 
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.
Geraint (David)  
View profile  
 More options Oct 19 2012, 10:25 am
From: "Geraint (David)" <geraintl...@gmail.com>
Date: Fri, 19 Oct 2012 07:25:16 -0700 (PDT)
Local: Fri, Oct 19 2012 10:25 am
Subject: Re: Questions about default

OK, I'm going to tackle this from the perspective of v4.  The "type"
property can no longer contain objects in v4.  To achieve a similar effect,
you have to use "oneOf" or "anyOf", depending on exactly what you want.

Using "oneOf" - there is no default.  All instances are valid under *both*inner schemas, which means that all instances are *not* valid under the
parent schema.
{
    "oneOf": [
        {"default:" {"a": "a"}},
        {"default:" {"b": "b"}}
    ]

}

So the only way to fix this is to add constraints to the inner schemas, at
which point - problem solved!  If an instance passes one, then one default
applies.  If it passes the other, the other default applies.  If it passes
both inner schemas, then it fails the parent schema, so it has no default
at all.


 
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.
Geraint (David)  
View profile  
 More options Oct 19 2012, 10:35 am
From: "Geraint (David)" <geraintl...@gmail.com>
Date: Fri, 19 Oct 2012 07:35:27 -0700 (PDT)
Local: Fri, Oct 19 2012 10:35 am
Subject: Re: Questions about default

With the second case (using "anyOf") - the default value from all matching
schemas is used.  In your example, both schemas would apply, so the
instance has multiple defaults.

So the essence of the problem is the same as using "allOf" (the equivalent
of "extends" in v3):
{
    "default": 1,
    "allOf": [
        {"default": 2},
        {"default": 3}
    ]

}

The issue here is this:  If we explicitly defined *which* default should be
used when there's more than one, we would need to define some kind of
ordering on the applied schemas.  That's a can of worms I don't want to
open.

So on balance, I would rather that we left the behaviour of "default"
undefined in this case.  Perhaps some wording clarifying this in the
specification, such as:

Since multiple schemas can describe an instance, instances may have
multiple conflicting default values.  Which default value (if any) should
be used in this case is not defined.

The specification does not explicitly state what agents can or cannot do
with the default value.  Given that, I don't think that we particularly
need to nail down what happens when there are multiple defaults.


 
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 »