Re: [Json] Schemas & so on

Anders Rundgren <anders.rundgren.net@gmail.com> Mon, 02 May 2016 05:58 UTC

Return-Path: <anders.rundgren.net@gmail.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 2254E12D0F5 for <json@ietfa.amsl.com>; Sun, 1 May 2016 22:58:12 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.699
X-Spam-Level:
X-Spam-Status: No, score=-2.699 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_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.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 C1Q55qTAYw8N for <json@ietfa.amsl.com>; Sun, 1 May 2016 22:58:10 -0700 (PDT)
Received: from mail-wm0-x234.google.com (mail-wm0-x234.google.com [IPv6:2a00:1450:400c:c09::234]) (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 C5DD212B062 for <json@ietf.org>; Sun, 1 May 2016 22:58:09 -0700 (PDT)
Received: by mail-wm0-x234.google.com with SMTP id g17so125233322wme.1 for <json@ietf.org>; Sun, 01 May 2016 22:58:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to; bh=XPaC1sHiy3PTj4gwd9p5X+fgSxYWWC9bGYBPDRyg7OE=; b=xLTdfCOlh6Wq480R9li5BJzVmOQeMOdXG+ly/A6893f6PrT04VS0yHhxYWqGSTCHh1 VunfK4cnt0b36X8orexlhKlAZKqQYbWAAVlrZs0JwecYTlGakCcxvxrzmfEUy2g2O5XY ABDpsavc6FXuNBNepxZoqrzV+OJUBSKiMUKNZvpiA54nV5zRa+Q1lQ6sN0JAzp40swvM 6E+kMFSRNu8ORt48i+wg6PLT2aj2LI8pKTbPeRq56oMLQ8+FQmkqFIyyIvUSaNpitcuk CuamaSWqSvXbnTYacU7K4qyMxJ3jE/PCFxGmobWN7vgMnjFUeKLMz8Yd/7QPHrd+Ed0m 4CUQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to; bh=XPaC1sHiy3PTj4gwd9p5X+fgSxYWWC9bGYBPDRyg7OE=; b=S7f8XbQAwrLjEVLNVpxgHRcNLMrRx/3w+1K9mrQWe4zt9aznF0YcLFmhUnhf/I+ryx YbBf3W21B0/AyQ4MsyGvKWe1SSFgsByobA90HnZl4nwH9gL1OrflUFgixHVMyJ+QoxzY dwmPs0VvTT7fq99Y9vhbsxcsglEP3t8eAe41qKPWlQepZFna5RC53CzQfJE0ITdbzgFr 2EwJC2YjAFlM/HB1U5LetdXfq2J4H8g+7ZpRneWQOtqKqKpTjq6yi5jR45TuS1TxyiDc 6EF+gzL5AyCZ/WGYVfT0Eo2QViUooZiE5m0ZEj3K84hzHTOOnErDPnOeoJII2ImK8jyQ OHCg==
X-Gm-Message-State: AOPr4FW8lVoU7V7LaVPXkzUiDfjLtfTAOohKGOMt5TGVGfW4qKJNsFj/w6xEFY9gAxZMTQ==
X-Received: by 10.194.221.37 with SMTP id qb5mr33615343wjc.171.1462168688166; Sun, 01 May 2016 22:58:08 -0700 (PDT)
Received: from [192.168.1.79] (124.25.176.95.rev.sfr.net. [95.176.25.124]) by smtp.googlemail.com with ESMTPSA id vu4sm28412695wjc.27.2016.05.01.22.58.06 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 01 May 2016 22:58:07 -0700 (PDT)
To: Tim Bray <tbray@textuality.com>, "json@ietf.org" <json@ietf.org>
References: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com>
From: Anders Rundgren <anders.rundgren.net@gmail.com>
Message-ID: <1d5080ea-f89a-fbdf-7de2-94443da02472@gmail.com>
Date: Mon, 2 May 2016 07:57:52 +0200
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
MIME-Version: 1.0
In-Reply-To: <CAHBU6itCV9MXmALdKtE9-vjUPG6-6ZqdqzrmZkcEzSUysi3S-w@mail.gmail.com>
Content-Type: multipart/alternative; boundary="------------160C499AE62A551E8E7DD5CC"
Archived-At: <http://mailarchive.ietf.org/arch/msg/json/XSauR_35navYh5zj84cp3YS7skE>
Subject: Re: [Json] Schemas & so on
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.17
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: Mon, 02 May 2016 05:58:12 -0000

On 2016-05-01 22:55, Tim Bray wrote:
>
> I find myself tasked with specifying a JSON-based DSL and preparing it for public release, with a validator and so on.
>
> I had never really concerned myself much with options for JSON language definition, but have discovered they’re not very good.  The JSON Schema project is not terribly appealing - opaque spec, poor documentation and tools - and smells of neglect (last I-D expired in 2013).  It's been suggested that a good approach would be just to write a jq program that emits true or false.
>
> Is there good conventional wisdom about formally specifying a JSON dialect?

I had used XML Schema for 10Y+ before I became a JSON "convert".

I addressed the problem you mentioned in another and less formal way:

1. Creating a strongly typed JSON parser with access methods like getString(), getInt() etc.  This also supports some derived types that you most likely need such as dateTime, BigInteger and BigDecimal (for the financial industry).

2. The I added a method for verifying that all elements have been read.

This works quite well but of course do not address the documentation issue or the ability creating JSON from static object declaration.

https://github.com/cyberphone/saturn/blob/master/resources/common/org/webpki/saturn/common/PayerAuthorization.java

Anders

>
> -- 
> - Tim Bray (If you’d like to send me a private message, see https://keybase.io/timbray)
>
>
> _______________________________________________
> json mailing list
> json@ietf.org
> https://www.ietf.org/mailman/listinfo/json