one-data-model / language

(Old repo:) Simple Definition Format (SDF) for One Data Model definitions
7 stars 4 forks source link

Need ODM SDF Syntax to Cover Product / Resource Object / Trait and Thing / Interface Version Mappings #67

Open gerickson opened 4 years ago

gerickson commented 4 years ago

In Weave Data Language (WDL), resources are equivalent to ODM "products". Over time, the definition of the resource may evolve and its version incremented as those changes occur. To the extent that changes in the resource need to be bound to specific versions of one or more underlying traits (objects) and interfaces (things), WDL provides a construct in the form of the _versionmap decoration to specify those dependencies.

To be expressed in ODM SDF losslessly, a syntax construct for representing this version mapping, when present, is required.

See related issue https://github.com/one-data-model/language/issues/60.

Relevant Example Schema Input Files

Missing or Unmapped WDL-to-ODM SDF Syntax

Example Input WDL

message TraitTestResource {
    option (wdl.message_type) = RESOURCE;

    option (wdl.resource) = {
        stability: ALPHA,
        vendor_id: NEST,
        vendor_product_id: 0xFE00,
        version: 2,
        version_map: [
            {
                resource_version: 2,
                trait_version_list: [
                    {name: "nest.test.trait.TestCTrait", version: 2},
                    {name: "nest.test.trait.TestDTrait", version: 2}
                ],
                iface_version_list: [
                    {name: "nest.test.iface.TestVersionedBasicIface", version: 2}
                ]
            }
        ]
    };

    nest.test.trait.TestATrait service_a = 1 [(wdl.traitconfig) = {published_by: EXTERNAL, proxied: false, subscribed: true}];
    nest.test.trait.TestBTrait service_b = 2 [(wdl.traitconfig) = {published_by: EXTERNAL, proxied: false, subscribed: true}];
    nest.test.trait.TestCTrait service_c = 3 [(wdl.traitconfig) = {published_by: EXTERNAL, proxied: false, subscribed: true}];
    nest.test.trait.TestDTrait service_d = 4 [(wdl.traitconfig) = {published_by: EXTERNAL, proxied: false, subscribed: true}];

    nest.test.trait.TestATrait device_a = 5 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 1}];
    nest.test.trait.TestBTrait device_b = 6 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 1}];
    nest.test.trait.TestCTrait device_c = 7 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 1}];
    nest.test.trait.TestDTrait device_d = 8 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 1}];

    // For multi-instance testing (e.g commands)
    nest.test.trait.TestATrait device_a2 = 9 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 2}];
    nest.test.trait.TestATrait device_a3 = 10 [(wdl.traitconfig) = {published_by: SELF, proxied: true, subscribed: false}, (wdl.traitinst) = {instance: 3}];

    message Implements {
        option (wdl.message_type) = IFACE_IMPLEMENTATIONS;

        nest.test.iface.TestBasicIface iface_1 = 1;

        nest.test.iface.TestNestedIface iface_2 = 2 [(wdl.implconfig) = {trait_mapping: [{from:"service_a", to:"trait_x"}]}];

        nest.test.iface.TestVersionedBasicIface iface_3 = 3 [(wdl.implconfig) = {min_version: 2}];
    };
};

message NestProtectCommonIface {
    option (wdl.message_type) = IFACE;

    option (wdl.iface) = {
        stability: PROD,
        vendor_id: NEST,
        version: 2,
    };

    message Implements {
        option (wdl.message_type) = IFACE_IMPLEMENTATIONS;

        weave.iface.common.DeviceIface device = 1;

        nest.iface.EnhancedPathlightIface enhanced_pathlight = 2 [(wdl.implconfig) = {min_version: 2}];
    };
};
WAvdBeek commented 4 years ago

I thought oneDM would not define products.

gerickson commented 4 years ago

@WAvdBeek, you are correct that OneDM is not defining products; however, the syntax must be able to cover a product or product-like construct if OneDM is to meet the expectation that other ecosystems that do have and do define products can use the syntax and tooling to supplant their own, internal tooling and syntax.