Re: [Asdf] Extension point mechanism thoughts

Michael Koster <michaeljohnkoster@gmail.com> Wed, 30 March 2022 15:24 UTC

Return-Path: <michaeljohnkoster@gmail.com>
X-Original-To: asdf@ietfa.amsl.com
Delivered-To: asdf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E74853A0D34 for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 08:24:00 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.108
X-Spam-Level:
X-Spam-Status: No, score=-2.108 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, 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, T_SCC_BODY_TEXT_LINE=-0.01] 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 hAlQdDTubjEO for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 08:23:58 -0700 (PDT)
Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) (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 6D1523A0D2A for <asdf@ietf.org>; Wed, 30 Mar 2022 08:23:58 -0700 (PDT)
Received: by mail-pl1-x635.google.com with SMTP id x2so20717929plm.7 for <asdf@ietf.org>; Wed, 30 Mar 2022 08:23:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:mime-version:subject:date:references:to:in-reply-to:message-id; bh=8Njuu2WYm2dz9hnxwv/9Gy8WRSM9v+EXjA2dAcJSGiM=; b=jfNTlo67Npoh4PH9XWqU6cVbNCTwBCQEUxtWSsHCu9jJu1EpDPSGvMX+gX+Kcdgsvb IjLuNyTD23E0rRlNTxACKDiSKQ9tw4gNa2LaytO63JKezWCRWmdrKuAhFpfQtxrZaTs1 uemG6sSJVm7nT+0O7vBFaK1NARNDEy8LGHfoyy15P9KPnqCZhD0I/hrIe/lV+bZI/hK3 5MQWS1MSMSnhJe+DGwETPSVfp7sU+ih1KKU0uZj5MYT7aSs034J0GuSjUrNHLnWfZ2Qv 4Utgt37v1Zfqcw7sinhrxTwOMKZOe3VKTYAjBPTFApzSLObWMZprFPZz/7quN8U4eGYB KOXw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:mime-version:subject:date:references:to :in-reply-to:message-id; bh=8Njuu2WYm2dz9hnxwv/9Gy8WRSM9v+EXjA2dAcJSGiM=; b=BlhmfWS7VOkiA0CwdIxQ7ShSnzabI9+wgdj2FEghvJkN69VRl89fMiY31esvsMozjB /dX+NJJNWWXBvo+a22v5/e/WzCiioK0JUqqASE62lYXlk63a88W9Jf6Is4A1JqYb4j8B D1D2fwWtXbk48n6GCC/OpHbPA83tC+Ij9ut2F8eTYXlqHJCFH/Rov9a8cwex+VKHTnr+ t3r0F9EU3vqHAq4OF7pa62/I2kQliSy9llpM0SSjiGnOtvRBa1MgaoAYU3CP7XYBSHsl TFwEv4XY/kEpwNBxJ72iyGXZofwRW0WsmmzkiDy840fd/OU1sBsN+SKJCb3ub9QPgyu3 gXKQ==
X-Gm-Message-State: AOAM530N9HGxjdblvPcskg5wmsMdiNnZtGjjBHEwl82okpzdd1o9umTj tcbqZDHceZ3UPtz+kFKDwRwWiHBATGQ=
X-Google-Smtp-Source: ABdhPJwfKN2QHSzUW67XlysOpD80RW5fms/rsHYFf06dQuRDQOf36VhvBoCak+Zw3QejJgbwBmF0Pw==
X-Received: by 2002:a17:90b:17c7:b0:1c7:c616:6eb0 with SMTP id me7-20020a17090b17c700b001c7c6166eb0mr25811pjb.144.1648653837017; Wed, 30 Mar 2022 08:23:57 -0700 (PDT)
Received: from [172.16.0.16] (c-73-170-109-142.hsd1.ca.comcast.net. [73.170.109.142]) by smtp.gmail.com with ESMTPSA id np8-20020a17090b4c4800b001c70aeab380sm7666838pjb.41.2022.03.30.08.23.56 for <asdf@ietf.org> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2022 08:23:56 -0700 (PDT)
From: Michael Koster <michaeljohnkoster@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_C4F166A2-807F-4ED7-AA4F-963769DE583D"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
Date: Wed, 30 Mar 2022 08:23:55 -0700
References: <F785FFBC-E751-426E-96CC-1601309E759E@gmail.com> <B51007CA-33B6-454D-8477-2DB8DB80EBBD@gmail.com> <A4AE4355-1260-4411-9087-13D68A150474@gmail.com>
To: asdf@ietf.org
In-Reply-To: <A4AE4355-1260-4411-9087-13D68A150474@gmail.com>
Message-Id: <0B698FC7-D2C7-4604-A4FA-821153578AD1@gmail.com>
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/asdf/WVOUj4OPyOZwTiDgBOi-TePKtg8>
Subject: Re: [Asdf] Extension point mechanism thoughts
X-BeenThere: asdf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "A Semantic Description Format \(SDF\) for Things and their Interactions and Data" <asdf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/asdf>, <mailto:asdf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/asdf/>
List-Post: <mailto:asdf@ietf.org>
List-Help: <mailto:asdf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/asdf>, <mailto:asdf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Wed, 30 Mar 2022 15:24:01 -0000

Is there a well defined way to merge schema fragments into a schema at schema-defined places? For JSO we could use JSON pointer (JSON path would be more robust...) and JSON merge-patch behavior; what about cddl?

> On Mar 30, 2022, at 8:20 AM, Michael Koster <michaeljohnkoster@gmail.com> wrote:
> 
> One more point, the schema extension mechanism provides for the first stage of development for new language features to be deployed in an organized way. 
> 
> For example, ext:meta could be the larval stage of a proposal for a built-in category "sdfMeta" in a later version of SDF. 
> 
> 
>> On Mar 30, 2022, at 8:08 AM, Michael Koster <michaeljohnkoster@gmail.com <mailto:michaeljohnkoster@gmail.com>> wrote:
>> 
>> I intended to add another entity to the schema that works in the same way as sdfData and can be applied to any definition, but is intended to provide named metadata items to any definition.
>> 
>> It'sr a way of adding a category as an extension, rather than a simple quality.
>> 
>>> On Mar 30, 2022, at 7:51 AM, Michael Koster <michaeljohnkoster@gmail.com <mailto:michaeljohnkoster@gmail.com>> wrote:
>>> 
>>> If we provide a generalized schema extension mechanism, it should be easy to use it to add a generic extension that applies the dataqualities constraint, and reuse that to provide a more developer-friendly interface that doesn't require the developer to add schema extensions for the simple use case of adding custom metadata to definitions.
>>> 
>>> extensionNamespace: { ext:" https://example.com/sdfextension <https://example.com/sdfextension>" }
>>> 
>>> at https://example.com/sdfextension <https://example.com/sdfextension> we define a schema extension that adds the "meta" quality to commonqualities and applies the existing dataqualities constraint to items that are defined by the new extension ( here in jso language but could also be cddl ):
>>> 
>> should say category, not quality, and it needs to be added to thingqualities, objectqualities, proertyqualities, actionqualities, and eventqualities
>>> {
>>>   id: https://example.com/sdfextension <https://example.com/sdfextension> 
>>>   schemaextension: ...sdfSchema/commonqualities: { additionalProperties: meta: { $ref:dataqualities } }
>>> }
>>> 
>>> 
>>> now we can use ext:meta when we want to attach custom metadata to a definition
>>> 
>>> sdfThing:
>>> 
>>>   ObjectTemplate:
>>>     ...
>>>     ext:meta:
>>>       TypeID: 
>>>         type: integer
>>>         minimum: 0
>>>         maximum: 65535
>>>       InstanceID:
>>>         type: integer
>>>         minimum: 0
>>>         maximum: 65535
>>>     # resources, etc.
>>>     sdfProperty: {}
>>>     sdfThing: {}
>>> 
>>> 
>>>   Timer:
>>>     sdfRef: /#/sdfThing/ObjectTemplate
>>>     ext:meta:
>>>       TypeID: { const: 43000 }
>>>       InstanceID: { default: 0 }
>>>     # resources, etc.
>>> 
>>> 
>>>   TimerInstance:
>>>      sdfRef: /#/sdfThing/Timer
>>>     ext:meta:
>>>       InstanceID: { const: 1001 }
>>>     # resources, etc.
>>> 
>>> 
>>> 
>> 
>