Re: [Asdf] Extension point mechanism thoughts

Michael Koster <michaeljohnkoster@gmail.com> Wed, 30 March 2022 15:30 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 8AA723A0DCD for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 08:30:29 -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 494VfOAfSAWk for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 08:30:27 -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 2E88A3A0DC6 for <asdf@ietf.org>; Wed, 30 Mar 2022 08:30:27 -0700 (PDT)
Received: by mail-pl1-x635.google.com with SMTP id m18so15849202plx.3 for <asdf@ietf.org>; Wed, 30 Mar 2022 08:30:27 -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=kkNQT6PN0kAYmS6Bmv59cCG5SSub+vYOWmOV15vCF1k=; b=OD/3LFv42rtBW31btk9jq4k0Z8tWWl2SB/ewSg4xkFFDCMvEpmnhsxrw+DOYvJY00Z jGIWXjv9r0g1dWddygAfDpmhSDKmAvzjdFjE8owb8svmehKAMtm31D2X4GBewrlv2FC2 ngeCd4rwcMyneeWHNPquMGjd8ozbWpZHICQ0Xx4vb1ws82/IQBf8oeNlBWGyyiC8ObJr xLaMszVXrac3GREHg2/JQZ01fsSSq5QU0PtnMgKzpb7DTj2QeQlGXt1czpZzZuBJSfrg HsNSaX01Q+PO7omDdcn/MxAhJ7fOJ+nY4d2RqwKC47pxFVBf1pbEf7JvnE5Z5FCDARuW HMWQ==
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=kkNQT6PN0kAYmS6Bmv59cCG5SSub+vYOWmOV15vCF1k=; b=A1wwxT3ly/U7mgZ3HozmnUc+L+6gnUAQRW0kzA2xxMINVv6xd4Mt0h7zGohhQAfsnZ XJOzVCLwlZG5G6Ln7h9xKMiTWArKvC72//XeaUttZ1t+NhrwdIriAsfA9JFHdcnywT5S L/MsOfK5MoGFk/9mNRyHx1NrAkoBi1qixJ1Y1N3Eme1USLKUJ+XiMysNed/IVuBtIoF+ GOudEklCak/Q4i+gon3E2oIEwZClKBGwHEGCqp3NNaj2UpuOe0XSGaKs9O9ABSe50nSY nmQGBMWvIVGNyOn8iL0i9Pd4A4LoY76sjYi3YqQoz3l4kVxEsJ2jdNuzopRMnFSFyrPD c3ZQ==
X-Gm-Message-State: AOAM532QbgvCE4JyOIr7kOH8fPLAx/u4ruHg0v7W1yomBd4YmwnHNfNO JmDMNd0pQxW8+nNvIY7+AgtMwizA/E0=
X-Google-Smtp-Source: ABdhPJxfFFG7oaLi1s1K+YJK90b9/QyaaiOcrZHmGuDrDi16EOHGdpZaYKPLKQuqIwLzwOJ9uL3mVA==
X-Received: by 2002:a17:90b:1a89:b0:1c6:4398:673 with SMTP id ng9-20020a17090b1a8900b001c643980673mr82056pjb.40.1648654225887; Wed, 30 Mar 2022 08:30:25 -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 b21-20020a17090a551500b001b90ef40301sm7424937pji.22.2022.03.30.08.30.24 for <asdf@ietf.org> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2022 08:30:25 -0700 (PDT)
From: Michael Koster <michaeljohnkoster@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_6597F874-54FE-4E01-9E53-48B80396A160"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
Date: Wed, 30 Mar 2022 08:30:24 -0700
References: <F785FFBC-E751-426E-96CC-1601309E759E@gmail.com> <B51007CA-33B6-454D-8477-2DB8DB80EBBD@gmail.com> <A4AE4355-1260-4411-9087-13D68A150474@gmail.com> <0B698FC7-D2C7-4604-A4FA-821153578AD1@gmail.com>
To: asdf@ietf.org
In-Reply-To: <0B698FC7-D2C7-4604-A4FA-821153578AD1@gmail.com>
Message-Id: <57512999-995C-4C7A-9087-093C2F403DE4@gmail.com>
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/asdf/EqpsgP6cO_Fnx0rKhWdtdLusbYw>
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:30:30 -0000

Schema extensions that merge-patch the schema could be used to do other things besides adding new terms and their definitions...

> On Mar 30, 2022, at 8:23 AM, Michael Koster <michaeljohnkoster@gmail.com> wrote:
> 
> 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 <mailto: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.
>>>> 
>>>> 
>>>> 
>>> 
>> 
>