[alto] ALTO JSON Schema Collection

Jensen Zhang <jingxuan.n.zhang@gmail.com> Mon, 22 March 2021 15:13 UTC

Return-Path: <jingxuan.n.zhang@gmail.com>
X-Original-To: alto@ietfa.amsl.com
Delivered-To: alto@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 89BC43A03FB for <alto@ietfa.amsl.com>; Mon, 22 Mar 2021 08:13:51 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.197
X-Spam-Level:
X-Spam-Status: No, score=-0.197 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, 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=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 rg-JNyk9Irty for <alto@ietfa.amsl.com>; Mon, 22 Mar 2021 08:13:46 -0700 (PDT)
Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) (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 1D2683A03F6 for <alto@ietf.org>; Mon, 22 Mar 2021 08:13:38 -0700 (PDT)
Received: by mail-wr1-x42d.google.com with SMTP id e18so17496321wrt.6 for <alto@ietf.org>; Mon, 22 Mar 2021 08:13:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=z/HYfA3lyWN4IRQTKDkrzEB7TkaFbGTINOaWei+uHD8=; b=sbG96BWuiKhXTL+oJ6dlbPagWKinItVtPSqYZQ1UhJu6ETBPRAxptCfU/T4PclY5n0 qeAI1fNE7RNmp5UwLsQAc4D8RvJc8ds6QoGeRZyiUJfgGjva+TBagqZUgmpxJwicm2YL opizmUIgDvDJAH0q5Y5ZMaVmWoUdhdfSn0BXU6AwjflwBYO5vxXpjej3wx6qUFFh/Ww0 5lJ5gpmfbbF/YAxWZw0Uoxj5157dRhv6/h8HA/lq0Qfqen71S/rxOUUFrN0E9rZkGgTj PJJ7/sGS6DeEzAfWa3sE3Cv1+/e5daJB1QfnB6AHSRh/4nHUJcImQQ6jlBHMUJf9qwTl X81w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=z/HYfA3lyWN4IRQTKDkrzEB7TkaFbGTINOaWei+uHD8=; b=e4yPhBdHofslfuQ6yGVOc+B9mQT9UCw7UCGdGRXAgU2LHHMPmshPt3TTZqd51fTiMV sIR+c/vzXblODNjnvE+IdqvXqMNvwT7zT1FF68aY10wGjfjTWMBnMGLyLNq//mSgvXgE 9ZJVcVwde4PC4yYJMgPlsevh5QH85q1W6vEaI0m1db+TxpiinMf7n+AxC5xp3+dF4NaH nm8c0PL+N3PsMfIIF1RKfUAcTnLeHPKrbKpRlRAliem96+cPgR5ewnqOkONLKLCH7sKl HMmjD/NhGY7E5HnaeFjpEBkK3c+qs4H9QSs9TGmd4g8Ak8fh8yY/+tCNHvYK3GrXEjDa TiVw==
X-Gm-Message-State: AOAM5334jBiPqVt09z4W6hptgdXnfXk6PPJHHstJuhqPCYpm+tG5pvi9 9ZhgK/B0WhIRTmNRmQVSiLZ6lw7POWZHVoRFkFQQKzLfrq7nZA==
X-Google-Smtp-Source: ABdhPJzLEeKcvFBQ12AYfE/sQCZ5yngHNQajVEbYmfuGDg/FIM67hRp4RJL2fOpKFIBEYcm8Y/1cqnuQr7omFohEUno=
X-Received: by 2002:a5d:4fc5:: with SMTP id h5mr20088wrw.33.1616426014950; Mon, 22 Mar 2021 08:13:34 -0700 (PDT)
MIME-Version: 1.0
From: Jensen Zhang <jingxuan.n.zhang@gmail.com>
Date: Mon, 22 Mar 2021 23:13:24 +0800
Message-ID: <CAAbpuyqeUPqr+YwNXk820DZmNE0Ljp11=+P9ngRsURuVTMg4AQ@mail.gmail.com>
To: IETF ALTO <alto@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000006d462605be218227"
Archived-At: <https://mailarchive.ietf.org/arch/msg/alto/ParSWWF2IYsj82fnv1X-aUVK5iI>
Subject: [alto] ALTO JSON Schema Collection
X-BeenThere: alto@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Application-Layer Traffic Optimization \(alto\) WG mailing list" <alto.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/alto>, <mailto:alto-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/alto/>
List-Post: <mailto:alto@ietf.org>
List-Help: <mailto:alto-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/alto>, <mailto:alto-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 22 Mar 2021 15:13:52 -0000

Hi all,

As multiple ALTO extensions have been or are going to be published and
introduce multiple versions of the ALTO message formats, I just create a
GitHub repo to maintain a collection of JSON schemas that can be used to
validate ALTO protocol messages in different versions:
https://github.com/openalto/alto-jsonschema

All the JSON schemas use version 7 JSON Schema notation. So far, all the
published RFCs (RFC7285, RFC8189, RFC8895, RFC8896) have been included. The
working drafts that are close to being published are on the way.

Note that each ALTO message format may have multiple versions of JSON
schemas, because multiple standards may extend the same message format. For
example,

1. RFC7285 defines ReqFilteredCostMap, and RFC8189 extends it and modifies
the validation condition. The following ReqFilteredCostMap message can only
pass the validation by JSON schemas applying RFC8189. The RFC7285 version
JSON schema will raise an error about "the required field cost-type is
missing".

~~~
{
    "multi-cost-types": [
        {"cost-mode": "numerical", "cost-metric": "routingcost"},
        {"cost-mode": "numerical", "cost-metric": "shoesize"}
    ],
    "pids" : {
        "srcs" : [ ],
        "dsts" : [ ]
    }
}
~~~

2. RFC7285 defines InfoResourceCostMap, and RFC8896 extends it. The RFC7285
version JSON schema will ignore "meta/calendar-response-attributes" and
pass the validation of the following InfoResourceCostMap message, while the
RFC8896 version schema will raise an error about
"meta/calendar-response-attributes should be an array".

~~~
{
    "meta" : {
        "dependent-vtags" : [
            {
                "resource-id": "my-default-network-map",
                "tag": "3ee2cb7e8d63d9fab71b9b34cbf764436315542e"
            }
        ],
        "cost-type" : { "cost-mode" : "numerical", "cost-metric" :
"throughputrating" },
        "calendar-response-attributes" : {}
    },
    "cost-map" : {
        "PID1": {
            "PID1": [ 1, 12, 14, 18, 14, 14, 14, 18, 19, 20, 11, 12],
            "PID2": [13,  4, 15, 16, 17, 18, 19, 20, 11, 12, 13, 14],
            "PID3": [20, 20, 18, 14, 12, 12, 14, 14, 12, 12, 14, 16]
        }
    }
}
~~~

The README file shows the link to each version of the JSON schema file.
Also, the `examples` directory includes all the JSON format ALTO message
examples appearing in RFCs.

There is an online validator demo that you can use to try the schemas:
https://openalto.github.io/alto-jsonschema/

I hope it will be helpful for others. Also, welcome to extend / correct /
improve it.

Best,
Jensen