Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch Clarifications #312

Draft
wants to merge 3 commits into
base: IDTA-01002-3-1_preparation
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info:
license:
name: CC BY 4.0
url: https://creativecommons.org/licenses/by/4.0/
version: V3.0.2_SSP-001
version: V3.1.0_SSP-001
x-profile-identifier: https://admin-shell.io/aas/API/3/0/AssetAdministrationShellRepositoryServiceSpecification/SSP-001
servers:
- url: '{protocol}://{host_name}:{port}/api/{version_prefix}'
Expand Down Expand Up @@ -564,8 +564,9 @@ paths:
- Asset Administration Shell Repository API
summary: Updates the Submodel
operationId: PatchSubmodel_AasRepository
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -660,7 +661,7 @@ paths:
summary: Updates the metadata attributes of the Submodel
operationId: PatchSubmodelById-Metadata_AasRepository
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/0
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -731,10 +732,10 @@ paths:
patch:
tags:
- Asset Administration Shell Repository API
summary: Updates teh values of the Submodel
summary: Updates the values of the Submodel
operationId: PatchSubmodelById-ValueOnly_AasRepository
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/0
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -1166,8 +1167,9 @@ paths:
- Asset Administration Shell Repository API
summary: Updates an existing submodel element value at a specified path within submodel elements hierarchy
operationId: PatchSubmodelElementValueByPath_AasRepository
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/0
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/1
parameters:
- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
requestBody:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,9 @@ paths:
- Asset Administration Shell API
summary: Updates the Submodel
operationId: PatchSubmodel
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -1023,8 +1024,9 @@ paths:
- Asset Administration Shell API
summary: Updates an existing submodel element value at a specified path within submodel elements hierarchy
operationId: PatchSubmodelElementValueByPath
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/0
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/1
parameters:
- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
requestBody:
Expand Down
23 changes: 15 additions & 8 deletions Entire-API-Collection/V3.0.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,9 @@ paths:
- Asset Administration Shell API
summary: Updates the Submodel
operationId: PatchSubmodel_AAS
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PutSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -1553,8 +1554,9 @@ paths:
- Submodel API
summary: Updates the Submodel
operationId: PatchSubmodel
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -2068,8 +2070,9 @@ paths:
- Submodel API
summary: Updates an existing SubmodelElement
operationId: PatchSubmodelElementByPath
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -3191,8 +3194,9 @@ paths:
- Asset Administration Shell Repository API
summary: Updates the Submodel
operationId: PatchSubmodel_AasRepository
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -3288,7 +3292,7 @@ paths:
summary: Updates the metadata attributes of the Submodel
operationId: PatchSubmodelById-Metadata_AasRepository
x-semanticIds:
- https://admin-shell.io/aas/API/PutSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/0
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -4667,8 +4671,9 @@ paths:
- Submodel Repository API
summary: Updates an existing Submodel
operationId: PatchSubmodelById
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -5274,8 +5279,9 @@ paths:
- Submodel Repository API
summary: Updates an existing SubmodelElement
operationId: PatchSubmodelElementByPath_SubmodelRepo
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -5368,8 +5374,9 @@ paths:
- Submodel Repository API
summary: Updates the metadata attributes an existing SubmodelElement
operationId: PatchSubmodelElementByPath-Metadata_SubmodelRepo
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/0
- https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/1
requestBody:
description: Metadata attributes of the SubmodelElement
content:
Expand Down
8 changes: 5 additions & 3 deletions SubmodelRepositoryServiceSpecification/V3.0_SSP-001.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info:
license:
name: CC BY 4.0
url: https://creativecommons.org/licenses/by/4.0/
version: V3.0.2_SSP-001
version: V3.1.0_SSP-001
x-profile-identifier: https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-001
servers:
- url: '{protocol}://{host_name}:{port}/api/{version_prefix}'
Expand Down Expand Up @@ -319,8 +319,9 @@ paths:
- Submodel Repository API
summary: Updates an existing Submodel
operationId: PatchSubmodelById
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
- name: level
in: query
Expand Down Expand Up @@ -921,8 +922,9 @@ paths:
- Submodel Repository API
summary: Updates an existing SubmodelElement
operationId: PatchSubmodelElementByPath_SubmodelRepo
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
- name: level
in: query
Expand Down
8 changes: 5 additions & 3 deletions SubmodelRepositoryServiceSpecification/V3.0_SSP-003.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ info:
license:
name: CC BY 4.0
url: https://creativecommons.org/licenses/by/4.0/
version: V3.0.2_SSP-003
version: V3.1.0_SSP-003
x-profile-identifier: https://admin-shell.io/aas/API/3/0/SubmodelRepositoryServiceSpecification/SSP-003
servers:
- url: '{protocol}://{host_name}:{port}/api/{version_prefix}'
Expand Down Expand Up @@ -243,8 +243,9 @@ paths:
- Submodel Repository API
summary: Updates an existing Submodel
operationId: PatchSubmodelById
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
- name: level
in: query
Expand Down Expand Up @@ -602,8 +603,9 @@ paths:
- Submodel Repository API
summary: Updates an existing SubmodelElement
operationId: PatchSubmodelElementByPath_SubmodelRepo
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1 # https://admin-shell.io/aas/API/PatchSubmodelElementByPath/3/1 ?
parameters:
- name: level
in: query
Expand Down
10 changes: 6 additions & 4 deletions SubmodelServiceSpecification/V3.0_SSP-001.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ info:
license:
name: CC BY 4.0
url: https://creativecommons.org/licenses/by/4.0/
version: V3.0.2_SSP-001
x-profile-identifier: https://admin-shell.io/aas/API/3/0/SubmodelServiceSpecification/SSP-001
version: V3.1.0_SSP-001
x-profile-identifier: https://admin-shell.io/aas/API/3/1/SubmodelServiceSpecification/SSP-001
servers:
- url: '{protocol}://{host_name}:{port}/api/{version_prefix}'
variables:
Expand Down Expand Up @@ -108,8 +108,9 @@ paths:
- Submodel API
summary: Updates the Submodel
operationId: PatchSubmodel
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodel/3/0
- https://admin-shell.io/aas/API/PatchSubmodel/3/1
parameters:
#- $ref: 'https://api.swaggerhub.com/domains/Plattform_i40/Part2-API-Schemas/V3.0.2#/components/parameters/Level'
- name: level
Expand Down Expand Up @@ -651,8 +652,9 @@ paths:
- Submodel API
summary: Updates an existing SubmodelElement
operationId: PatchSubmodelElementByPath
deprecated: true
x-semanticIds:
- https://admin-shell.io/aas/API/PatchSubmodelById/3/0
- https://admin-shell.io/aas/API/PatchSubmodelById/3/1
parameters:
- name: level
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ add DeleteBulkSubmodelDescriptorsById
||PostBulkSubmodelDescriptors |new |
||PutBulkSubmodelDescriptorsById|new |
||DeleteBulkSubmodelDescriptorsById|new |
| PatchSubmodel | Deprecate PATCH for non-metadata and non-value-only paths | change | |
| PatchSubmodelById | Deprecate PATCH for non-metadata and non-value-only paths | change | |
| PatchSubmodelElementByPath | Deprecate PATCH for non-metadata and non-value-only paths | change | |
|===

=== Profile Changes w.r.t. V3.0.2 to V3.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,19 @@ path-suffix= $metadata/$value/$reference/$path or no suffix for normal
?extent=WithoutBLOBValue/WithBLOBValue

|PutSubmodel |PUT |/submodel |
|PatchSubmodel |PATCH |/submodel |path-suffix=$metadata/$value or no path for normal
|PatchSubmodel |PATCH |/submodel |path-suffix=/$metadata or /$value

For /$metadata: +
The serialised submodel in the request body must not contain any SubmodelElements. +
The server must overwrite all metadata-relevant Submodel fields with the received fields. This means in particular that previously used fields of the Submodel instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays. In particular, a client must therefore send the complete content of arrays (e.g. for `description` or `displayName`).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that classical PUT behavior? How does this differ from PUT?


For /$value: +
The server must overwrite all ValueOnly-relevant Submodel fields with the received values. This means in particular that previously used fields of the Submodel instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays, for instance, for SubmodelElementLists.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a 1:1 copy from other sections but I think it would be better to write something different and more specific to modifying the value of a submodel. E.g., this text mentions SubmodelElementLists which are not relevant here because we are talking about modifying an array of SubmodelElements without the need to know what the elements are.

More important, this won't work becaue valueOnly serialization does not contain all information to "create" new elements. Imaging a submodel without any child elements. Through PATCH on /$value we now send something like {"foo": 42}. What is the result? We could deduct that this is a property called foo, but we cannot infer the type of foo (double, int, short, ???) as the valueOnly serialization does not hold the necessary type information.
As a consequence, adding the elements via valueOnly must not be allowed which would require quite complex processing to check because of arbitrary nesting depth and also because type checking would need to happen.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but I think it would be better to write something different

Always open for better proposals

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More important, this won't work because valueOnly serialization does not contain all information to "create" new elements.

It was the outcome of the last group call to define it like that. Please raise the topic again there, together with a respective formulation, to cover also this case.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an issue of how to phrase things but a technical issue that this approach will not work.
In the REST API WG calls I did propose to follow standard JSON Merge Patch behavior and drop support for PATCH on /$metadata and /$value; a proposal that does not suffer from the problem we are talking about.
This problem will always exist when doing a PATCH on /$value because there is no type information in the valueOnly serialization. From my perspective there are only two "fixes": change the valueOnly serialization to include type information (bad idea) or to not allow PATCH on /$value.

I don't know what else to tell you or what else to present besides the simple solution I already proposed which is following best practices for REST APIs and just go with RFC 7386 JSON Merge Patch


====
Note: The endpoint paths without any additional path-suffixes have been deprecated with version 3.1.0
====

|GetAllSubmodelElements |GET |/submodel/submodel-elements a|
?level=deep/core

Expand Down Expand Up @@ -422,27 +434,28 @@ URL-encoded IdShortPath
|PatchSubmodelElementByPath |PATCH |/submodel/submodel-elements/\{idShortPath} a|
use separated idShort path of this element

path-suffix=$metadata/$value or no suffix for normal
path-suffix=/$metadata or /$value

URL-encoded IdShortPath

For /$metadata: +
The serialised SubmodelElement in the request body must not contain any values. +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typical PUT behavior?

The server must overwrite all metadata-relevant SubmodelElement fields with the received fields. This means in particular that previously used fields of the SubmodelElement instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays. In particular, a client must therefore send the complete content of arrays (e.g. for `description` or `displayName`).

For /$value: +
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to PATCH /submodel/$value, however, for certain cases this potentially might work, e.g. if limited to only work on elements of type Property. Even this would still require defining additional semantics such as what happens when having a property of type DateTime and sending a numeric value from which we cannot infer the concrete type from the valueOnly serialization?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a broader topic. We currently do not require the server to check whether the value value actually fits to the format claimed in valueType.

The server must overwrite all ValueOnly-relevant SubmodelElement fields with the received values. This means in particular that previously used fields of the SubmodelElement instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays, for instance, for SubmodelElementLists.

====
Note: values remain unchanged with content=metadata
Note 1: The endpoint paths without any additional path-suffixes have been deprecated with version 3.1.0
====

====
Note 2: See Clause 11.4.2 for values.
====

|PatchSubmodelElementValueByPath |PATCH |/submodel/submodel-elements/\{idShortPath}/$value a|
use separated idShort path of this element; see Clause 11.4.2 for values

path-suffix=$value

URL-encoded IdShortPath

|DeleteSubmodelElementByPath |DELETE |/submodel/submodel-elements/\{idShortPath} a|
use separated idshort path of this element

URL-encoded IdShortPath
====
Note 3: values remain unchanged with content=metadata
====

|InvokeOperationSync |POST |/submodel/submodel-elements/\{idShortPath}/invoke a|
path-suffix=$value or no suffix for normal
Expand Down Expand Up @@ -521,7 +534,19 @@ base64url-encoded identifier

|PostSubmodel |POST |/submodels |
|PutSubmodelById |PUT |/submodels/\{submodelIdentifier} |base64url-encoded identifier
|PatchSubmodelById |PATCH |/submodels/\{submodelIdentifier} |path-suffix=$metadata/$value or no suffix for normal
|PatchSubmodelById |PATCH |/submodels/\{submodelIdentifier} |path-suffix=/$metadata or /$value
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issues as for PatchSubmodel


For /$metadata: +
The serialised submodel in the request body must not contain any SubmodelElements. +
The server must overwrite all metadata-relevant Submodel fields with the received fields. This means in particular that previously used fields of the Submodel instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays. In particular, a client must therefore send the complete content of arrays (e.g. for `description` or `displayName`).

For /$value: +
The server must overwrite all ValueOnly-relevant Submodel fields with the received values. This means in particular that previously used fields of the Submodel instance that are missing in the request body indicate a deletion of them. It is not possible to change single items in contained arrays, for instance, for SubmodelElementLists.

====
Note: The endpoint paths without any additional path-suffixes have been deprecated with version 3.1.0
====

|DeleteSubmodelById |DELETE |/submodels/\{submodelIdentifier} |base64url-encoded identifier
|SubmodelInterface |* |/submodels/\{submodelIdentifier}/* |superpath as defined in service specification or profile
| |
Expand Down
Loading