Re: [Json] JSON Schema Language: extensibility and unspecified properties

Henry Andrews <andrews_henry@yahoo.com> Sat, 10 August 2019 19:55 UTC

Return-Path: <andrews_henry@yahoo.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id CC555120041 for <json@ietfa.amsl.com>; Sat, 10 Aug 2019 12:55:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.997
X-Spam-Level:
X-Spam-Status: No, score=-1.997 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yahoo.com
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7QNnFhjM5g9T for <json@ietfa.amsl.com>; Sat, 10 Aug 2019 12:55:44 -0700 (PDT)
Received: from sonic313-14.consmr.mail.bf2.yahoo.com (sonic313-14.consmr.mail.bf2.yahoo.com [74.6.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id B48F512002F for <json@ietf.org>; Sat, 10 Aug 2019 12:55:43 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1565466942; bh=qoRUTtYRkFwZ7RjHK8rMy0GS0TIOrETuHd/pNUnP+1Q=; h=Date:From:Reply-To:To:In-Reply-To:References:Subject:From:Subject; b=eK5eMUIL+SPdqt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Voa1UiUkXMrQS7.0d.K21srI27__YUqgPy34E3GbuOUMx35.kEVA6TdfaAwucPetKyWXA4l40 xcaT1gQazxrvEiOUBmEF2Qzorh79xfGXYZO7wmv6alqcl_cRfIq1Mx4Rri5ev6IeLiJE01RXY58S j6QmtriGxTPCiF4Ks5p_nah77P3yYRuDCFnh8INq9bEZgSmpQZrD2ac6WYVuHNiFfXQLaLgBIG3O CNnQM.v5tCHx9uteX4IsT.NPTOhxc_6EdUUfvjuOwQDhkf6iR1KmUGj.bDtS5xPkPARNxIVUdzcc ryH6KlY7ckPg_zE8CxFvr1LtECiGgThvpR74XcD8_sNjh1AR4gV9g.u5vsnavL5Lnt9OBncf6aLg vqJA4VFKKVUDIXhVZig.A2KVwE1JZT5Aad_GeMbaRjyWFY8rdeICd..oR5aoji2_eXOWD9fm.HnM mdYMdEujNOB3boXEYlePF3CWRk.bOfbBhQQZzGPdF27U0Q4yolQsLLg--
Received: from sonic.gate.mail.ne1.yahoo.com by sonic313.consmr.mail.bf2.yahoo.com with HTTP; Sat, 10 Aug 2019 19:55:42 +0000
Date: Sat, 10 Aug 2019 19:55:37 +0000
From: Henry Andrews <andrews_henry@yahoo.com>
Reply-To: Henry Andrews <andrews_henry@yahoo.com>
To: JSON WG <json@ietf.org>
Message-ID: <1371506030.2752303.1565466937101@mail.yahoo.com>
In-Reply-To: <8d56f00d-14af-c387-ff02-e279cca6ddea@gmail.com>
References: <CAJK=1RhXp85cz-pOAQPw2JM=CYHgGSygj4Hw0spht56jbzQE2g@mail.gmail.com> <8d56f00d-14af-c387-ff02-e279cca6ddea@gmail.com>
MIME-Version: 1.0
Content-Type: multipart/alternative; boundary="----=_Part_2752302_885198095.1565466937099"
X-Mailer: WebService/1.1.14097 YMailNorrin Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/VeDkkSaEkakBJG6-J4S_kL7DXjs>
Subject: Re: [Json] JSON Schema Language: extensibility and unspecified properties
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Sat, 10 Aug 2019 19:55:47 -0000

 I know folks here are not interested in JSON Schema itself, but i will point out that we have spent most of the past year on exactly this problem.  JSON Schema vocabularies are identified by URIs, which implementations can use to load extension libraries.  The keyword taxonomy we have developed classifies keywords into several sorts of high-level behaviors (primarily assertions, which produce boolean validation outcomes, annotations, which attach information for applications to consume, and applicators, which apply subschemas and potentially combine or modify their results), allowing extensible JSON Schema implementations to provide hooks for handling those basic types of keywords.
This work is the primary focus of the new draft, which will be published by the end of August.  Here are some links to the vocabulary- and taxonomy-related sections in the work-in-progress review copies:
http://json-schema.org/work-in-progress/WIP-jsonschema-core.html#rfc.section.6.5
http://json-schema.org/work-in-progress/WIP-jsonschema-core.html#rfc.section.7
http://json-schema.org/work-in-progress/WIP-jsonschema-core.html#rfc.section.8
   
thanks,-henry
 On Saturday, August 10, 2019, 12:01:20 PM PDT, Anders Rundgren <anders.rundgren.net@gmail.com> wrote:  
 
 If we stick to unspecified properties I'm currently working with a
payment authorization scheme where some components will be defined
by the payment networks.  The components start with a defined property
holding a JSON Object but the contents of the object is not known by
the "main" schema.

In my programmatic solution the "main schema" ignores such components
and only validates that they conform JSON.  The components are
then dealt with by customer supplied decoders which indeed may use
a schema.

How can you express this in a main schema using JCL?

Anders

  paymentRequest = new PaymentRequest(rd.getObject(PAYMENT_REQUEST_JSON));
  undecodedPaymentMethodSpecific = rd.getObject(BACKEND_METHOD_SPECIFIC_JSON);
  rd.scanAway(BACKEND_METHOD_SPECIFIC_JSON);
  referenceId = rd.getString(REFERENCE_ID_JSON);


On 2019-08-10 03:43, Ulysse Carion wrote:
> Hi folks,
> 
> Thanks again for all the wonderful suggestions for JSON Schema
> Language. I've just published a new draft incorporating suggestions
> from the last update. You can read it here:
> 
> https://tools.ietf.org/html/draft-ucarion-json-schema-language-02
> 
> I would like advice on the two following changes I've made to the spec.
> 
> First, I added explicit discussion of how JSL can be extended. The
> language is at the end of section 2, but I'll reproduce it here:
> 
>> This document does not describe any extension mechanisms for JSL schema
>> validation. However, schemas (through the `non-keyword` CDDL rule in this
>> section) are defined to allow members whose names are not equal to any of the
>> specially-defined keywords (i.e. `definitions`, `elements`, etc.) described in
>> this section. Call these members "non-keyword members".
>>
>> Users MAY add additional, non-keyword members to JSL schemas to convey
>> information that is not pertinent to validation. For example, such non-keyword
>> members could provide hints to code generators, or trigger some special behavior
>> for a library that generates user interfaces from schemas.
>>
>> Users SHOULD NOT expect non-keyword members to be understood by other parties.
>> As a result, if consistent validation with other parties is a requirement, users
>> SHOULD NOT use non-keyword members to affect how schema validation, as described
>> in {{semantics}}, works.
> 
> Basically, my stance is: you can add custom stuff to schemas, but you
> can't change validation. I expect that people will change validation
> anyway, but they're not going to expect portability. I don't feel that
> adding some sort of registry of keywords / forms is valuable yet.
> Perhaps something like that can be in whatever replaces JSL?
> 
> How do folks feel about this? Does anyone have suggestions on better
> ways I can approach extensibility, or how I should phrase this
> language?
> 
> The other thing I want advice on is "strict" mode, called "strict
> instance semantics" in the spec. Basically, strict instance semantics
> about whether it's ok to send "extra"/"unknown"/"unspecified"
> properties in an object.
> 
> Right now, validation behavior is specified as a single, top-level
> "strict": true/false (default is "true") property. You can't mix and
> match strict and non-strict. But Carsten off-list noted that might be
> a bit "blunt". Do others agree?
> 
> The context for my decision is that two of major typed languages used
> in industry, Java and Golang, don't typically support mixing and
> matching. Go just as a blunt DisallowUnknownFields:
> 
> https://golang.org/pkg/encoding/json/#Decoder.DisallowUnknownFields
> 
> And Java's Jackson has a FAIL_ON_UNKNOWN_PROPERTIES:
> 
> http://fasterxml.github.io/jackson-databind/javadoc/2.9/com/fasterxml/jackson/databind/DeserializationFeature.html#FAIL_ON_UNKNOWN_PROPERTIES
> 
> Both are all or nothing.
> 
> Also, there is the question of whether "strict" is a good name for
> this property in schemas. Is there a better name for it? "strict" can
> be understood in many ways. Open to ideas here as well.
> 
> Other changes:
> 
> - Removed int64/uint64 (and removed discussion related to I-JSON)
> - Clarified that 1.0e1 is an integer
> 
> Finally, I've moved JSL to a desired status of "Informative", and I'll
> be going through the independent stream once the discussion here
> appears to have settled.
> 
> Thanks again for all the help,
> Ulysse
> 
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json
> 

_______________________________________________
json mailing list
json@ietf.org
https://www.ietf.org/mailman/listinfo/json