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 the Extension and Extendability of Properties #51

Open gerickson opened 5 years ago

gerickson commented 5 years ago

In Weave Data Language (WDL), both traits and properties within traits may be extended or derived to the extent that they have been marked as such.

Relevant Example Schema Input Files

Missing or Unmapped WDL-to-ODM SDF Syntax

Example Input WDL

message PowerSourceCapabilitiesTrait {
        option (wdl.message_type) = TRAIT;

        option (wdl.trait) = {
          stability: PROD,
                vendor_id: 0x0000,
                id:        0x0018,
                version:   1
        };

        // ----------- PROPERTIES ----------- //

        option (wdl.properties) = {
                writable: READ_ONLY,
                variability: STATIC,
                extendable: true,
                reserved_tag_min: 1,
                reserved_tag_max: 31
        };

        PowerSourceType         type              = 1;

        weave.common.StringRef  description       = 2 [(wdl.prop) = { string_constraints: { max_length: 32 },
                                                                      optional: true,
                                                                      nullable: true}];

        float                  nominal_voltage    = 3 [(wdl.prop) = { quantity_type: VOLTAGE,
                                                                      number_constraints: { min: 0.0, max: 700.0,
                                                                      precision: 0.001,
                                                                      fixed_encoding_width: 32 }},
                                                       (wdl.tlv)  = { encoding: FIXED } ];

        float                   maximum_current   = 4 [(wdl.prop) = { optional: true,
                                                                      nullable: true,
                                                                      quantity_type: CURRENT,
                                                                      number_constraints: { min: 0.0, max: 1000.0,
                                                                      precision: 0.001,
                                                                      fixed_encoding_width: 32 }},
                                                       (wdl.tlv)  = { encoding: FIXED } ];

        PowerSourceCurrentType  current_type      = 5;

        uint32                  order             = 6;

        bool                    removable         = 7;
}

message BatteryPowerSourceCapabilitiesTrait {
        option (wdl.message_type) = TRAIT;

        option (wdl.trait) = {
          stability: ALPHA,
                vendor_id: 0x0000,
                id:        0x001B,
                version:   1
        };

        message BatteryDesignation {
                option (wdl.message_type) = STRUCT;
                option (wdl.structopts) = {
                        extendable: false
                };

                weave.common.StringRef              designation_description        = 1 [(wdl.prop) = { string_constraints: { max_length: 32 },
                                                                                                       optional: true,
                                                                                                       nullable: true}];

                CommonBatteryDesignationIdentifier  common_designation_identifier  = 2 [(wdl.prop) = { optional: true,
                                                                                                       nullable: false}];

                ANSIBatteryDesignationIdentifier    ansi_designation_identifier    = 3 [(wdl.prop) = { optional: true,
                                                                                                       nullable: false}];

                IECBatteryDesignationIdentifier     iec_designation_identifier     = 4 [(wdl.prop) = { optional: true,
                                                                                                       nullable: false}];
        }

        // ----------- PROPERTIES ----------- //

        option (wdl.properties) = {
                writable: READ_ONLY,
                variability: STATIC,
                extends: {
                    trait: "weave.trait.power.PowerSourceCapabilitiesTrait"
                },
                extendable: true,
                reserved_tag_min: 32,
                reserved_tag_max: 47
        };

        bool                         rechargeable = 32;

        float                        capacity     = 33 [(wdl.prop) = { quantity_type: ELECTRIC_CHARGE,
                                                                       number_constraints: { min: 0.0, max: 4000.0,
                                                                       precision: 0.001,
                                                                       fixed_encoding_width: 32 },
                                                                       optional: true,
                                                                       nullable: true },
                                                        (wdl.tlv)  = { encoding: FIXED } ];

        BatteryChemistry             chemistry    = 34;

        uint32                       count        = 35;

        BatteryReplaceability        replaceable  = 36;

        BatteryDesignation           designations = 37 [(wdl.prop) = { optional: true,
                                                                       nullable: true }];
}