Skip to content

model: fix stripping single-quotes from string values#309

Merged
filak-sap merged 1 commit into
masterfrom
i295
Jul 17, 2026
Merged

model: fix stripping single-quotes from string values#309
filak-sap merged 1 commit into
masterfrom
i295

Conversation

@phanak-sap

Copy link
Copy Markdown
Contributor

from_json() received a plain Python string already decoded from JSON — OData JSON responses never wrap Edm.String values in single quotes, so the strip was wrong and silently truncated values that legitimately begin or end with "'". Return the value unchanged instead.

from_literal() receives an OData URI literal of the form 'value' and must remove exactly one wrapping pair. Replace strip("'") with a guarded slice (value[1:-1]) that fires only when both ends carry a quote, leaving inner leading/trailing quotes intact.

Existing unit tests were enhanced to fill test gaps.

Two pre-existing tests were also corrected: they passed OData-literal-wrapped strings (e.g. "'x'") as from_json input, which only passed because the buggy strip silently unwrapped them. Real JSON payloads carry bare string values; the test data has been updated to reflect that.

Closes #295

from_json() received a plain Python string already decoded from JSON — OData
JSON responses never wrap Edm.String values in single quotes, so the strip was
wrong and silently truncated values that legitimately begin or end with "'".
Return the value unchanged instead.

from_literal() receives an OData URI literal of the form 'value' and must
remove exactly one wrapping pair. Replace strip("'") with a guarded slice
(value[1:-1]) that fires only when both ends carry a quote, leaving inner
leading/trailing quotes intact.

Existing unit tests were enhanced to fill test gaps.

Two pre-existing tests were also corrected: they passed OData-literal-wrapped
strings (e.g. "'x'") as from_json input, which only passed because the buggy
strip silently unwrapped them. Real JSON payloads carry bare string values;
the test data has been updated to reflect that.

Closes #295
@phanak-sap
phanak-sap requested a review from filak-sap July 17, 2026 09:23
@phanak-sap phanak-sap added the bug Something isn't working label Jul 17, 2026
@filak-sap
filak-sap merged commit fe79f0d into master Jul 17, 2026
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

some character is truncated during API execution

2 participants