server: Implement the read-only $value routes - #623
Open
thammel wants to merge 1 commit into
Open
Conversation
All `$value` routes previously responded with `501 Not Implemented`.
The specification leaves some points open, which are resolved as
follows:
- Property values are mapped to the JSON type of their `valueType`, so
booleans and numbers are not quoted. Values without a JSON literal
are returned as their XSD representation.
`xs:integer` is unbounded in both Python and JSON and is
therefore passed on as it is.
- Elements without a value are omitted from Submodels, collections and
Entity statements, but kept as `null` within a SubmodelElementList, as
omitting them would shift the indices of the remaining elements.
- Operations and Capabilities have no ValueOnly representation. They are
skipped in containers and result in `400 Bad Request` when requested
directly, which is how the `$metadata` route handles them.
- `level=core` returns the direct children of the requested resource and
their nested containers as empty, matching the examples of the
specification.
- The entries of `GET /submodels/{id}/submodel-elements/$value` are
mapped by idShort, as a bare `SubmodelElementValue` would lose the
association between a value and its element. Submodels are returned
as-is, since their entries are already named.
- The languages of a MultiLanguageProperty are sorted, to keep the order
of the response deterministic.
The ValueOnly serialization is only defined for JSON, so the routes
respond with `406 Not Acceptable` if XML is requested. `extent` remains
unimplemented, as on all other routes. `PATCH …/$value`, the `$path`
routes and the operation invocation routes are not part of this change.
Fixes eclipse-basyx#446
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
All
$valueroutes previously responded with501 Not Implemented.The specification leaves some points open, which are resolved as follows:
valueType, so booleans and numbers are not quoted. Values without a JSON literal are returned as their XSD representation.xs:integeris unbounded in both Python and JSON and is therefore passed on as it is.nullwithin a SubmodelElementList, as omitting them would shift the indices of the remaining elements.400 Bad Requestwhen requested directly, which is how the$metadataroute handles them.level=corereturns the direct children of the requested resource and their nested containers as empty, matching the examples of the specification.GET /submodels/{id}/submodel-elements/$valueare mapped by idShort, as a bareSubmodelElementValuewould lose the association between a value and its element. Submodels are returned as-is, since their entries are already named.The ValueOnly serialization is only defined for JSON, so the routes respond with
406 Not Acceptableif XML is requested.extentremains unimplemented, as on all other routes.PATCH …/$value, the$pathroutes and the operation invocation routes are not part of this change.Fixes #446