-
Notifications
You must be signed in to change notification settings - Fork 26
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
Add changes for idShortPath and ValueOnly fixes from part 2 v3.0.2 #372
Add changes for idShortPath and ValueOnly fixes from part 2 v3.0.2 #372
Conversation
@@ -37,7 +38,7 @@ The following rules shall be adhered to when serializing a submodel with the Ser | |||
** _Range_ is serialized as named JSON object with $\{Range/idShort} as the name of the containing JSON property. The JSON object contains two JSON properties. The first is named “min”. The second is named “max”. Their corresponding values are $\{Range/min} and $\{Range/max}. | |||
** _File_ and _Blob_ are serialized as named JSON objects with $\{File/idShort} or $\{Blob/idShort}as the name of the containing JSON property. The JSON object contains two JSON properties. The first refers to the content type named $\{File/contentType} resp. $\{Blob/contentType}. The latter refers to the value named “value” $\{File/value} resp. $\{Blob/value}. The resulting ValueOnly object is indistinguishable whether it contains File or Blob attributes. Therefore, the receiver needs to take the type of the target resource into account. Since the receiver knows in advance if a File or a Blob SubmodelElement shall be manipulated, it can parse the transferred ValueOnly object accordingly as a File or Blob object. | |||
** _SubmodelElementCollection_ is serialized as named JSON object with $\{SubmodelElementCollection/idShort} as the name of the containing JSON property. The elements contained within the struct are serialized according to their respective type with $\{SubmodelElement/idShort} as the name of the containing JSON property. | |||
** _SubmodelElementList_ is serialized as a JSON array with the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. | |||
** _SubmodelElementList_ is serialized as a JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
** _SubmodelElementList_ is serialized as a JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. | |
** _SubmodelElementList_ is serialized as a named JSON array with ${SubmodelElementList/idShort} as the name of the containing JSON property followed by the index in square brackets of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
** _SubmodelElementList_ is serialized as a JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. | |
** _SubmodelElementList_ is serialized as a named JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property. The elements in the JSON array are the ValueOnly serializations of the elements contained in the SubmodelElementList while preserving the order, i.e. index n in the JSON array is the ValueOnly serialization of the element at index n of the SubmodelElementList. |
@BirgitBoss
How can the index of a JSON array contain square brackets? That does not make sense.
What exactly are you proposing the resulting JSON looks like? As I understand it, your proposal results in something like this
{
"{SubmodelElementList/idShort}": {
"[0]": { ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number
"[1]: { ... }, // valueOnly serialization of element with index 1
...
}
}
which is not in line with the format described by the PR which is
{
"{SubmodelElementList/idShort}": [
{ ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number
{ ... }, // valueOnly serialization of element with index 1
...
]
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BirgitBoss How can the index of a JSON array contain square brackets? That does not make sense. What exactly are you proposing the resulting JSON looks like? As I understand it, your proposal results in something like this
{ "{SubmodelElementList/idShort}": { "[0]": { ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number "[1]: { ... }, // valueOnly serialization of element with index 1 ... } }
which is not in line with the format described by the PR which is
{ "{SubmodelElementList/idShort}": [ { ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number { ... }, // valueOnly serialization of element with index 1 ... ] }
I mixed it with the idShortPath representation, you are right.
@@ -7,14 +7,14 @@ https://creativecommons.org/licenses/by/4.0/). | |||
SPDX-License-Identifier: CC-BY-4.0 | |||
|
|||
Illustrations: | |||
Plattform Industrie 4.0; Anna Salari, Publik. Agentur f�r Kommunikation GmbH, designed by Publik. Agentur f�r Kommunikation GmbH | |||
Plattform Industrie 4.0; Anna Salari, Publik. Agentur für Kommunikation GmbH, designed by Publik. Agentur für Kommunikation GmbH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Plattform Industrie 4.0; Anna Salari, Publik. Agentur für Kommunikation GmbH, designed by Publik. Agentur für Kommunikation GmbH |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove complete sentence
//// | ||
|
||
=== Format "Path" (IdShortPath Serialization) in JSON | ||
|
||
To get only the idShort paths of a submodel element hierarchy, the serialization format is specified in terms of an idShortPath notation to be returned in an unnamed JSON-array. The notation differs depending on whether a SubmodelElementCollection or a SubmodelElementList is used. In the first case, the submodel element's idShort is separated by "." (dot) from top level down to child level. In the second case, square brackets with an index "[\<<index>>]" are appended after the idShort of the containing SubmodelElementList. | ||
To get only the idShort paths of a submodel element hierarchy, the serialization format is specified in terms of an idShortPath notation to be returned in an unnamed JSON-array. The notation differs depending on whether a SubmodelElementCollection or a SubmodelElementList is used. In the first case, the submodel element's idShort is separated by "." (dot) from top level down to child level. In the second case, square brackets with an index "[\<<index>>]" are appended after the idShort of the containing SubmodelElementList. In any case, the first item of any idShortPath is the idShort if the requested element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To get only the idShort paths of a submodel element hierarchy, the serialization format is specified in terms of an idShortPath notation to be returned in an unnamed JSON-array. The notation differs depending on whether a SubmodelElementCollection or a SubmodelElementList is used. In the first case, the submodel element's idShort is separated by "." (dot) from top level down to child level. In the second case, square brackets with an index "[\<<index>>]" are appended after the idShort of the containing SubmodelElementList. In any case, the first item of any idShortPath is the idShort if the requested element. | |
To get only the idShort paths of a submodel element hierarchy, the serialization format is specified in terms of an idShortPath notation to be returned in an unnamed JSON-array. The notation differs depending on whether a SubmodelElementCollection or a SubmodelElementList is used. In the first case, the submodel element's idShort is separated by "." (dot) from top level down to child level. In the second case, square brackets with an index "[\<<index>>]" are appended after the idShort of the containing SubmodelElementList. In any case, the first item of any idShortPath is the idShort of the requested element. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Smaller reformulations, typos
|
||
In the following example, where a request for idShort paths starts at _MySubmodelElementCollection_ with SerializationModifier level = deep, the list of idShort paths is returned as follows: | ||
In the following example, where a request for idShort paths targets a _MySubmodelElementCollection_ with SerializationModifier level = deep, the list of idShort paths is returned as follows: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why target? It is the starting point (relative to this collection)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In TF API we agreed on terminology "requesting element" (this is the first in the list)
@mjacoby may youp lease review |
@@ -37,7 +38,7 @@ The following rules shall be adhered to when serializing a submodel with the Ser | |||
** _Range_ is serialized as named JSON object with $\{Range/idShort} as the name of the containing JSON property. The JSON object contains two JSON properties. The first is named “min”. The second is named “max”. Their corresponding values are $\{Range/min} and $\{Range/max}. | |||
** _File_ and _Blob_ are serialized as named JSON objects with $\{File/idShort} or $\{Blob/idShort}as the name of the containing JSON property. The JSON object contains two JSON properties. The first refers to the content type named $\{File/contentType} resp. $\{Blob/contentType}. The latter refers to the value named “value” $\{File/value} resp. $\{Blob/value}. The resulting ValueOnly object is indistinguishable whether it contains File or Blob attributes. Therefore, the receiver needs to take the type of the target resource into account. Since the receiver knows in advance if a File or a Blob SubmodelElement shall be manipulated, it can parse the transferred ValueOnly object accordingly as a File or Blob object. | |||
** _SubmodelElementCollection_ is serialized as named JSON object with $\{SubmodelElementCollection/idShort} as the name of the containing JSON property. The elements contained within the struct are serialized according to their respective type with $\{SubmodelElement/idShort} as the name of the containing JSON property. | |||
** _SubmodelElementList_ is serialized as a JSON array with the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. | |||
** _SubmodelElementList_ is serialized as a JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
** _SubmodelElementList_ is serialized as a JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property the index of the contained SubmodelElement in the list as the position in the JSON array. The elements contained within the list are serialized according to their respective type. | |
** _SubmodelElementList_ is serialized as a named JSON array with $\{SubmodelElementList/idShort} as the name of the containing JSON property. The elements in the JSON array are the ValueOnly serializations of the elements contained in the SubmodelElementList while preserving the order, i.e. index n in the JSON array is the ValueOnly serialization of the element at index n of the SubmodelElementList. |
@BirgitBoss
How can the index of a JSON array contain square brackets? That does not make sense.
What exactly are you proposing the resulting JSON looks like? As I understand it, your proposal results in something like this
{
"{SubmodelElementList/idShort}": {
"[0]": { ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number
"[1]: { ... }, // valueOnly serialization of element with index 1
...
}
}
which is not in line with the format described by the PR which is
{
"{SubmodelElementList/idShort}": [
{ ... }, // where {...} is valueOnly serialization of element with index 0, doesn't have to be a JSON object but could also be a prmiitve JSON vlaue such as string or number
{ ... }, // valueOnly serialization of element with index 1
...
]
}
correct text, examples were correct, no? Co-authored-by: Michael Jacoby <[email protected]>
Adaptation of adoc should complie to latest valueOnlyand IdShortPath Specification