Skip to content

Fix what live Dataverse requests showed: batch decoding, $ref addresses and replacing casts - #440

Merged
tnkuehne merged 1 commit into
mainfrom
dataverse-batch-decoding
Nov 26, 2026
Merged

tnkuehne merged 1 commit into
mainfrom
dataverse-batch-decoding

Conversation

@tnkuehne

Copy link
Copy Markdown
Contributor

Running every write path of the Dataverse template against a real environment exposed a few bugs.

Fixes

  • batch answers were corrupted. The multipart framing was decoded as UTF-8 and each text part byte by byte, so non-ASCII text such as Müller and binary file content came back mangled. The framing is now read as bytes, and text parts are decoded as UTF-8. A new test covers a UTF-8 JSON part next to a binary part; it fails with the old decoding.
  • $ref addresses must be absolute. Dataverse refuses contacts(<id>) in associateRows and setReference ("A relative URI value … was specified"). The descriptions now ask for https://<environment>/api/data/v9.2/contacts(<id>).
  • updateRelatedRow removed. Dataverse answers PATCH through a navigation property with 405.
  • replaceRow and replaceRelatedRow take type. Dataverse accepts PUT on a cast address such as …/Attributes(LogicalName='x')/Microsoft.Dynamics.CRM.StringAttributeMetadata. That is the address a definition read with a cast comes from, and such a definition carries no @odata.type.
  • Answer headers are decoded as UTF-8. Dataverse sends a file's name in UTF-8, which Fetch reads one byte per character (Prüfbericht.txt).
  • Docs.
    • createRelatedRow answers no address for the new row, and return=representation fails there with a Dataverse server error.
    • Single uploads take application/octet-stream; text/plain gets 415.

Live run

All 30 checks passed against a Developer environment, and every test row and table was removed afterwards. The run covered:

  • Rows: create (with OData-EntityId, $expand and deep insert), not_modified, single columns
  • Queries: parameter aliases, change tracking through the delta link as nextLink, $count, $ref
  • Metadata: every cast; creating, replacing and deleting a table and its text, choice and file columns
  • Files: single and chunked upload, download, Range
  • batch: change sets with Content-ID references, rollback, file bytes

…es and replacing casts

Batch answers decoded their framing as UTF-8 and their text parts byte by
byte, which corrupted file content and non-ASCII text; framing is now read
as bytes and text parts as UTF-8.

Dataverse takes $ref addresses only absolute, answers no address for a row
created through a navigation property and refuses PATCH through one, so
the descriptions say so and updateRelatedRow is gone. replaceRow and
replaceRelatedRow take a type cast, as Dataverse accepts PUT on a cast
address. Answer headers are read as UTF-8, as Dataverse sends file names,
and single uploads are documented as application/octet-stream.
@tnkuehne
tnkuehne merged commit 2fdcca0 into main Nov 26, 2026
14 of 15 checks passed
@tnkuehne
tnkuehne deleted the dataverse-batch-decoding branch November 26, 2026 22:41
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.

1 participant