[Asdf] Extension point mechanism thoughts

Michael Koster <michaeljohnkoster@gmail.com> Wed, 30 March 2022 14:51 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 77D703A0BD8 for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 07:51:08 -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 uFpkFUO3kPxD for <asdf@ietfa.amsl.com>; Wed, 30 Mar 2022 07:51:04 -0700 (PDT)
Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) (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 417993A0BB3 for <asdf@ietf.org>; Wed, 30 Mar 2022 07:51:04 -0700 (PDT)
Received: by mail-pj1-x1036.google.com with SMTP id bx24-20020a17090af49800b001c6872a9e4eso168041pjb.5 for <asdf@ietf.org>; Wed, 30 Mar 2022 07:51:04 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:mime-version:subject:message-id:date:to; bh=R9vKYe+k+lKF6xmcKKQLuDDw3n+4i1Tz6SlSAcwn/yY=; b=O0935jZzXrZ5maL2952ZWcNCSR61kgdIRcxMmSZQ57TFglRU+YgvxyPbA0fT/FSt69 0aqiDNAfEWxflJ2CcM/Ty4j1TgaIR5hlZZmVTwblNdaiLgq70JimtMFywHgiwYXFQZ07 VVuuNJMgm3g7EeI+F3EXWEFc0iNI2FJ9vTCahYXD9fj1dGggN1ySVWVtPirA3BNwDZFo Vr1FdUUU6iOfEPAbQJFohTWCOWonL1SlRx1m+DIxUJvtnE3xvQvKkMHWTYvKYPGsUYOM qSMhoMxoqtgnKsXZ8SlMwGtTQGm+oxbr6wwBtWZHm6nO8k0ZtKrFi46skwnhTEWdjPx7 e2eg==
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:message-id:date:to; bh=R9vKYe+k+lKF6xmcKKQLuDDw3n+4i1Tz6SlSAcwn/yY=; b=b1PXMj3bl3KukC8eZJGl23DAkqweqSy6c+m5rwKU4/2sjF3sVO5iP0mbGt+BRBtTRf s6HazCgqxA3JYH5BWqJf8kIMBT/Mnpw1WMNuWf7iE65iuwjXWGISMrj2VNvon47LSBQl Ub8SONzT4jJdmO9dQJdsmNW20wughiJFWh4iHEBNWx7cghixhoSjHmz3uwoylQeBrBFV tLcKU0cVSE1Xn4GDYLAtRpRMGb4Vjr1aszU1s1sG16caEGnDfi+3FoFv0HCzwSWcjKDA /4Txxydha4ZXBNRUiOHQNQb4ZrA1+dRwg9yPDrwHsi6lGH6I8TWbYdMXFUvPB4z5//Wb 95JA==
X-Gm-Message-State: AOAM530tjJRBG11d+pdn6tZRUiav6Gm6Bjh6jSWhgzjaaSftuxtVgSYE nUvfzDPvHr1Uw8u58kYrwPIkCR+s3Zg=
X-Google-Smtp-Source: ABdhPJxTiBEtaTwJ+QeQYysfoQrlxHhkE27g02PSrw256CQVyMP2zEpKctAK7HOMfp2BJ1jgG7akEA==
X-Received: by 2002:a17:902:b185:b0:14f:2d94:184 with SMTP id s5-20020a170902b18500b0014f2d940184mr35919468plr.56.1648651862487; Wed, 30 Mar 2022 07:51:02 -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 a16-20020a637050000000b00385f92b13d1sm19301600pgn.43.2022.03.30.07.51.01 for <asdf@ietf.org> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Mar 2022 07:51:02 -0700 (PDT)
From: Michael Koster <michaeljohnkoster@gmail.com>
Content-Type: multipart/alternative; boundary="Apple-Mail=_5126C9A8-5DBB-4997-A656-D71842315603"
Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.60.0.2.21\))
Message-Id: <F785FFBC-E751-426E-96CC-1601309E759E@gmail.com>
Date: Wed, 30 Mar 2022 07:51:00 -0700
To: asdf@ietf.org
X-Mailer: Apple Mail (2.3654.60.0.2.21)
Archived-At: <https://mailarchive.ietf.org/arch/msg/asdf/UoDVVGMlxZ8INH6SFjOsO8QBnb8>
Subject: [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 14:51:09 -0000

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" }

at 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 ):

{
  id: 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.