Currently the presence of a cursor value in the creation of a JsonResponse determines, if the
response body consists purely of the data or if a paging_metadata element is added.
|
def serialize(self, obj: ResponseData, cursor: Optional[int], stripped: bool) -> str: |
|
if cursor is None: |
|
data = obj |
|
else: |
|
data = { |
|
"paging_metadata": {"cursor": str(cursor)}, |
|
"result": obj |
|
} |
The spec defines in contrast to this, that the response to a pagination request must always contain the paging_metadata element. If the end of the result set has been reached with this request, the cursor attribute has to be omitted.
Therefore we need to find an alternative to the cursor value to determine if a response should contain a paging_metadata .
For XMLResponse the currently implemented behavior encodes the cursor as attribute of the <response> tag, regardless if the value is None. Clarification is necessary if this is according to specification.
Currently the presence of a
cursorvalue in the creation of aJsonResponsedetermines, if theresponse body consists purely of the data or if a
paging_metadataelement is added.basyx-python-sdk/server/app/interfaces/base.py
Lines 86 to 93 in c128a52
The spec defines in contrast to this, that the response to a pagination request must always contain the
paging_metadataelement. If the end of the result set has been reached with this request, thecursorattribute has to be omitted.Therefore we need to find an alternative to the
cursorvalue to determine if a response should contain apaging_metadata.For
XMLResponsethe currently implemented behavior encodes thecursoras attribute of the<response>tag, regardless if the value isNone. Clarification is necessary if this is according to specification.