one-data-model / language

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

Use JSON Pointer for inputData and outputData #69

Open mjkoster opened 5 years ago

mjkoster commented 5 years ago

Rather than create a new class for different uses of data, we should define inputData and outputData for Actions and Events as pointers to odmData definitions, using the same pattern as for required (https://github.com/one-data-model/language/issues/68):

odmObject {
  Brightness {
    required [ 
      { $ref 0/odmData/currentBrightness }
      { $ref 0/odmAction/setBrightness }
    ]
    odmProperty {
      currentBrightness {
        type number
      }
    }
    odmAction {
      setLevel { 
        inputData [
          { $ref 0/odmData/targetBrightness }
          { $ref 0/odmData/transitionTime }
        ]
        required [
          { $ref 0/odmData/targetBrightness }
        ]
        odmData {
          targetBrightness {
            type number
          }
          transitionTime {
            type number
          }
        }
      }
    }
  }
}
mjkoster commented 5 years ago

See #38, #40, and #63

WAvdBeek commented 5 years ago

can the example be in JSON?

mjkoster commented 5 years ago
{
  "odmObject": {
    "Brightness": {
      "required": [
        {
          "$ref": "0/odmData/currentBrightness"
        }, 
        {
          "$ref": "0/odmAction/setBrightness"
        }
      ], 
      "odmProperty": {
        "currentBrightness": {
          "type": "number"
        }
      }, 
      "odmAction": {
        "setLevel": {
          "inputData": [
            {
              "$ref": "0/odmData/targetBrightness"
            }, 
            {
              "$ref": "0/odmData/transitionTime"
            }
          ], 
          "required": [
            {
              "$ref": "0/odmData/targetBrightness"
            }
          ], 
          "odmData": {
            "targetBrightness": {
              "type": "number"
            }, 
            "transitionTime": {
              "type": "number"
            }
          }
        }
      }
    }
  }
}
asoloway64 commented 5 years ago

F2F4: Add "odmInputRequired" at "odmAction" level. This is not needed for "odmEvent", because "odmRequired" is already available. "odmRequired" is applied to objects, actions (output) and events (output).

mjkoster commented 4 years ago

Added "odmRequiredInputData" to qualities of odmAction

mjkoster commented 4 years ago

I think we might want to reconsider using odmRequiredOutputData to provide a more explicit definition. IOW, Actions would have required input data and output data to be more consistent with the input data and output data definitions.

Likewise, odmEvents would have the odmRequiredOutputData quality instead of odmRequired

odmRequired would still be used to specify required properties, actions, events in an object, etc.

odmData would still use JSON schema...