SAP / python-pyodata

Enterprise-ready Python OData client
Apache License 2.0
225 stars 94 forks source link

Expanded properties don't have their own results wrapper in V2 like this library expects #258

Closed manuelseeger closed 1 year ago

manuelseeger commented 1 year ago

In OData V2 JSON, expanded properties are simple arrays of the contained entities.

See https://www.odata.org/documentation/odata-version-2-0/json-format/ Section 9, 9. Inline Representation of Associated Entries

However, pyodata expects the nested entities to be wrapped in a results object:

https://github.com/SAP/python-pyodata/blob/ea558f504532e378e182952db5e78aead3d23a6e/tests/test_service_v2.py#L1492C18-L1492C25 https://github.com/SAP/python-pyodata/blob/ea558f504532e378e182952db5e78aead3d23a6e/pyodata/v2/service.py#L875C31-L875C31

This is not according to spec and will fail with common implementations (including SAP service providers) as in the expanded property will discard the array received from the service and will default to an empty list.

phanak-sap commented 1 year ago

Hi @manuelseeger, thank you for nice bug report, with already PR fixing the problem. Excellent 👍

This is the oldest part of the code and yet so far was acceptable. How surprising. Primary use case that time was usage against S4HANA SADL-based services - so that's perhaps why it is "not according to spec and will fail with common implementations (including SAP service providers)". Still i am puzzled that this stick for such long time.

Thanks for all the work.