admin-shell-io / aas-specs-api

Repository of the Asset Administration Shell Specification DTA-01002 API
https://admin-shell-io.github.io/aas-specs-antora/index/home/index.html
Creative Commons Attribution 4.0 International
12 stars 5 forks source link

Value-Only serialization of `Operation`s #259

Closed arnoweiss closed 6 months ago

arnoweiss commented 6 months ago

What happens?

Let's assume, a server handles a request GET /submodels/{{mySubmodelId}}/$value to a Submodel with two Properties and one Operation SubmodelElement. For Properties there's a schema entry (p.108) and examples (p.163). For value-only-serialization of the SubmodelElement Operation, there's no examples. The schema only contains OperationRequestValueOnly and OperationResponseValueOnly (p.107). These are primarily used for the POST /submodels/{{mySubmodelId}}/{{pathToOperation}}/invoke/$value request - not for representation as SubmodelElement as the outputArguments are missing from the request payload.

Why is this wrong?

There's no clearly specified way to serialize Operations in the value-serialization. If it's invisible by design, that should be stated explicitly.

How should it be fixed?

Add statement like "The value-serialization for a Operation SubmodelElement is its idShort as key and a new OperationValueOnly schema as value". Example:

{
 "myOperation": {
    "inputArguments": {
      "myParameter1": 0,
      "mySubmodelElementIntegerPropertyList": [
        1,
        2,
        30,
        40
      ]
    },
    "outputArguments": {
      "myResultBody": "someString"
    },
    "inOutputArguments": {}
  }
}

...

mjacoby commented 6 months ago

To my understanding, operations are not part of the valueOnly serialization. This is based on Section 11.4.2 (p.96)

Values are only available for • All subtypes of abstract type DataElement, • SubmodelElementList and SubmodelElementCollection resp. for their included SubmodelElements, • ReferenceElement, • RelationshipElement + AnnotatedRelationshipElement, • Entity, • BasicEventElement.

This also makes sense as operation arguments in the operation definitions typically do not have values but are only templates to be filled with values when the operation is actually invoked. So it is stated in the specification but there would be no harm in adding some sentences mentioning all elements that are not supported/included in valueOnly serialization and add an explanation why this is the case.

To me, the more interesting question would be if it is a valid use case that operation arguments in the operation definition can have values, e.g. representing a default value or some kind of static value that is not expected to be provided upon invocation. If this is a valid use case, wouldn't it make sense to at least serialize these properties?

arnoweiss commented 6 months ago

Ah, didn't realize that this list is incomplete by design. Thanks for clarifying.