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

Draft with invalid data returns invalid result #551

Closed
DianaLease opened this issue May 19, 2020 · 2 comments
Closed

Draft with invalid data returns invalid result #551

DianaLease opened this issue May 19, 2020 · 2 comments
Labels
0.20 Type: Bug 🐛 Something isn't working

Comments

@DianaLease
Copy link
Member

Describe the bug
If a template expects an integer for a variable, passing a string that cannot be coerced into a valid intege, results in a draft result with NaN in the text.

To Reproduce
Steps to reproduce the behavior:

  1. Run cicero draft --data data.json --template src/acceptance-of-delivery/ where data.json is the following...
{
 "clauseId": "89ce3388-6765-4a6b-b9c8-cce05321aa2a",
 "shipper": "Party A",
 "receiver": "Party B",
 "deliverable": "Widgets",
 "businessDays": "a",
 "attachment": "Attachment X",
 "$class": "org.accordproject.acceptanceofdelivery.AcceptanceOfDeliveryClause"
}
  1. See result
Acceptance of Delivery.
----

"Party A" will be deemed to have completed its delivery obligations
if in "Party B"'s opinion, the "Widgets" satisfies the
Acceptance Criteria, and "Party B" notifies "Party A" in writing
that it is accepting the "Widgets".

Inspection and Notice.
----

"Party B" will have NaN Business Days to inspect and
evaluate the "Widgets" on the delivery date before notifying
"Party A" that it is either accepting or rejecting the
"Widgets".

Acceptance Criteria.
----

The "Acceptance Criteria" are the specifications the "Widgets"
must meet for the "Party A" to comply with its requirements and
obligations under this agreement, detailed in "Attachment X", attached
to this agreement.

Expected behavior
If the template expects an integer and is given a string that cannot be coerced into a valid integer, draft should return an error.

@DianaLease DianaLease added Type: Bug 🐛 Something isn't working 0.20 labels May 19, 2020
@jeromesimeon
Copy link
Member

jeromesimeon commented May 19, 2020

I think just a consequence of the current validation semantics for Concerto. See accordproject/concerto#157

Preventing this kind of surprising result will automatically happen as soon as we switch to the stricter validation semantic decided for the next version of Concerto.

@jeromesimeon
Copy link
Member

jeromesimeon commented May 27, 2021

@DianaLease Fixed in Cicero 0.22 with the lovely strict validation from Concerto 1.0! 😃

zsh-5.8$ more data.json 
{
 "clauseId": "89ce3388-6765-4a6b-b9c8-cce05321aa2a",
 "shipper": "Party A",
 "receiver": "Party B",
 "deliverable": "Widgets",
 "businessDays": "a",
 "attachment": "Attachment X",
 "$class": "org.accordproject.acceptanceofdelivery.AcceptanceOfDeliveryClause"
}
zsh-5.8$ cicero draft --data data.json --template src/acceptance-of-delivery
10:57:16 AM - ERROR: Expected value "a" to be of type Long
zsh-5.8$ cicero --version
0.22.0
zsh-5.8$ 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.20 Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants