Skip to content
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 testcase for #187 #2

Merged
merged 1 commit into from
Jan 27, 2022
Merged

Conversation

inxonic
Copy link
Contributor

@inxonic inxonic commented Jan 10, 2022

No description provided.

filak-sap pushed a commit to SAP/python-pyodata that referenced this pull request Jan 11, 2022
While Edm.Binary values are Base64 encoded in JSON payload [1][1], the
specification demands a prefixed and quoted Base16 encoding for values in URIs
and HTTP headers [2][2].

As there has been no specific conversion for Edm.Binary so far and we want to
stay backward compatible, the Python side representation shall remain a string
with the Base64 encoded payload.

However there are cases, where the literal is generated from the payload and
sent to the server, that expects it in the correct format.  E.g. this happens
when building the resource path while using a Edm.Binary property as an entity
key (see #187 and phanak-sap/pyodata-issue-files#2).

Another case might be when using the $include filter for a Edm.Binary property.

To meet those requirements, we want to have these representations:

 JSON   | Python       | Literal
--------|--------------|------------------------
 Base64 | str (Base64) | prefixed quoted Base16

This adds a specific type for Edm.Binary with the necessary conversions.

Further it extends the test cases to cover those conversions.

As the Edm.Binary type has been used to test the generic prefixed conversions,
we need to switch this to the Edm.Byte type, that remains generic.

[1](https://www.odata.org/documentation/odata-version-2-0/json-format)
[2](https://www.odata.org/documentation/odata-version-2-0/overview/)
@phanak-sap phanak-sap merged commit 94dcf56 into phanak-sap:master Jan 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants