basyx-python-sdk icon indicating copy to clipboard operation
basyx-python-sdk copied to clipboard

server/app/interfaces/repository.py: Implement missing `/submodels/{submodelIdentifier}/submodel-elements/{idShortPath}` endpoints

Open moritzsommer opened this issue 6 months ago • 1 comments

Current Situation

Currently, several server endpoints under /submodels/{submodelIdentifier}/submodel-elements/{idShortPath} are not implemented:

"/$metadata", methods=["PATCH"], endpoint=self.not_implemented
"/$value", methods=["GET"], endpoint=self.not_implemented)
"/$value", methods=["PATCH"], endpoint=self.not_implemented
"/$path", methods=["GET"], endpoint=self.not_implemented
"/invoke", methods=["POST"], endpoint=self.not_implemented
"/invoke/$value", methods=["POST"], endpoint=self.not_implemented
"/invoke-async",  methods=["POST"], endpoint=self.not_implemented
"/invoke-async/$value",  methods=["POST"],  endpoint=self.not_implemented
"/operation-status/<base64url:handleId>", methods=["GET"], endpoint=self.not_implemented

According to the Submodel Repository Service OpenAPI Specification, the PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$metadata endpoint should update the metadata attributes of an existing Submodel Element.

[...]
responses:
        '204':
          description: SubmodelElement updated successfully
[...]

The GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value endpoint should return a specific Submodel Element from the Submodel at a specified path in value only representation.

[...]
responses:
        '200':
          description: Requested submodel element
          content:
            application/json:
              schema:
                $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/SubmodelElementValue'
[...]

The PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value endpoint should update the value of an existing Submodel Element.

[...]
responses:
        '204':
          description: Submodel updated successfully
[...]

The GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$path endpoint should return a specific Submodel Element from the Submodel at a specified path in path notation.

[...]
responses:
        '200':
          description: Requested submodel element
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/PathItem'
[...]

The POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke endpoint should synchronously or asynchronously invoke an operation at a specified path.

[...]
responses:
        '200':
          description: Operation result object
          content:
            application/json:
              schema:
                $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/OperationResult'
[...]

The POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value endpoint should synchronously or asynchronously invoke an operation at a specified path.

[...]
responses:
        '200':
          description: Operation result object
          content:
            application/json:
              schema:
                $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/OperationResultValueOnly'
[...]

The POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async endpoint should asynchronously invoke an operation at a specified path.

[...]
responses:
        '202':
          $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/responses/accepted'
[...]

The POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value endpoint should asynchronously invoke an operation at a specified path.

[...]
responses:
        '202':
          $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/responses/accepted'
[...]

The GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/operation-status/{handleId} endpoint should return the status of an asynchronously invoked operation.

[...]
responses:
        '200':
          description: Operation result object containing information that the 'executionState' is still 'Running'
          content:
            application/json:
              schema:
                $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.1#/components/schemas/BaseOperationResult'
[...]

This issue specifies https://github.com/eclipse-basyx/basyx-python-sdk/issues/439.

Proposed Change

We should evaluate and, if feasible, implement the nine missing PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$metadata, GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value, PATCH /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$value, GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/$path, POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke, POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke/$value, POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async, POST /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/invoke-async/$value and GET /submodels/{submodelIdentifier}/submodel-elements/{idShortPath}/operation-status/{handleId} endpoints according to the specification.

moritzsommer avatar May 10 '26 15:05 moritzsommer

Superseded by the regrouping by underlying mechanism (see #439):

  • GET .../submodel-elements/{idShortPath}/$value → #644
  • PATCH .../submodel-elements/{idShortPath}/$value → #645
  • GET .../submodel-elements/{idShortPath}/$path → #643
  • PATCH .../submodel-elements/{idShortPath}/$metadata → #646

The Operation routes (invoke, invoke/$value, invoke-async, invoke-async/$value, operation-status) are not planned for now, for the same reason as in #532: how an Operation is invoked and what it returns depends on the use case and cannot be defined generally at SDK level.

Closing in favor of these issues.

zrgt avatar Sep 24 '26 11:09 zrgt