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 for Reusable Plain Old Data (POD) Types (aka Structs) #48

Open gerickson opened 5 years ago

gerickson commented 5 years ago

In Weave Data Language (WDL), it is possible to express in schema the concept of a reusable plain old data (POD) type (aka struct) which may then be reused in multiple traits (objects).

To be expressed in ODM SDF losslessly, a syntax construct for representing structs is needed.

Relevant Example Schema Input Files

Example Input WDL

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}];
}
mjkoster commented 5 years ago

odmData can be defined and used as a type with odmType { $ref odmData }