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

Interpreter does not re-order record fields even when all labels are provided #988

Closed
stefanobaghino-da opened this issue May 7, 2019 · 0 comments · Fixed by #989
Closed
Labels
component/daml-engine DAML-LF Engine & Interpreter

Comments

@stefanobaghino-da
Copy link
Contributor

When records are passed through the Ledger API their fields are expected to appear in order as per their definitions. If this does not happen, an error is raised.

If all labels are passed, though, the interpreter could re-order them so that order no longer matters in this case. This would enable bindings implementations to model records as dictionaries/objects/associative arrays easily and reliably.

@stefanobaghino-da stefanobaghino-da added the component/daml-engine DAML-LF Engine & Interpreter label May 7, 2019
stefanobaghino-da added a commit that referenced this issue May 8, 2019
* Re-order fields in records if all labels are provided

Fixes #988

* Add line to release notes

* Fix line on release notes

* Document change on the Ledger API definition

* Simplify pattern matching

* Improve and fix tests

Integration tests now look for the "Missing field label" rather then the
"Mismatching record label" when inspecting errors. Furthermore, a test
has been added that ensures that repetitions in labels still raise an
error.

* Add comment

Comment about relationship between fields length check and fields reordering based on labels

Co-Authored-By: stefanobaghino-da <43749967+stefanobaghino-da@users.noreply.github.com>

* Improve Ledger API docstring

Explicitly state the semantics of labeled fields (i.e. repeated keys are not accepted)

Co-Authored-By: stefanobaghino-da <43749967+stefanobaghino-da@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/daml-engine DAML-LF Engine & Interpreter
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant