graphql-mesh icon indicating copy to clipboard operation
graphql-mesh copied to clipboard

[oData Handler] Implementation of calling an single entity is not correct

Open chrisweirich opened this issue 3 years ago • 0 comments

When a single entity is called, the odata service is not called according to the specified odata protocol. With very strict odata services (e.g. SAP) this leads to errors.

Protocol: https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_Entity

http://host/service/Customers(1)

Implementation graphql mesh odata handler

http://host/service/Customers/1/

Suggestion https://github.com/Urigo/graphql-mesh/blob/master/packages/handlers/odata/src/index.ts#L441

        function addIdentifierToUrl(url, identifierFieldName, identifierFieldTypeRef, args) {
            // Only round brackets are allowed and a string must be surrounded with '
            url.href += (typeof args[identifierFieldName] === 'string') ? `('${args[identifierFieldName]}')` : `(${args[identifierFieldName]})`;
        }

chrisweirich avatar Mar 28 '22 14:03 chrisweirich