I was asked the following:
If we send extra data that’s not defined in a template schema what is supposed to happen? For example, say we have a template that defines a structure:
{
"foo": string,
}
and we provide a payload to ledger of:
{
"foo": "bar",
"other": "other data",
}
Will ledger ignore “other” or throw an error?
1 Like
Using Canton 2.10.0, that depends on whether you are submitting to the Ledger API (gPRC) or the JSON API.
The Ledger API responds with:
COMMAND_PREPROCESSING_FAILED:
Expecting 3 field for record... but got 4
The JSON API ignores the extra fields.
1 Like
Using Canton 3.3.0-snapshot.20250319.0, the situation is a bit different.
The Ledger API responds with:
COMMAND_PREPROCESSING_FAILED:
Found non-optional extra field "note",
cannot remove for downgrading.
The Ledger JSON API responds with:
INVALID_ARGUMENT:
The submitted request has invalid arguments:
Unexpected fields: note