You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Most errors include location information, but validation and type not found errors do not.
Describe the solution you'd like
When validating a JSON instance against a model fails, provide location information for where the error occurred in the JSON instance.
When loading a model which has an unknown type, provide location information for where that type is used in the model.
Describe alternatives you've considered
I haven't.
bash-3.2$ concerto generate --ctoFiles test/models/typenotfound.cto
Undeclared type BUBBLE in property org.accordproject.money.CryptoMonetaryAmount.doubleValue File 'test/models/typenotfound.cto': IllegalModelException: Undeclared type BUBBLE in property org.accordproject.money.CryptoMonetaryAmount.doubleValue File 'test/models/typenotfound.cto':
bash-3.2$
bash-3.2$ concerto validate --ctoFiles test/models/money.cto --sample test/data/sample2.json
Instance undefined invalid enum value true for field CurrencyCode ValidationException: Instance undefined invalid enum value true for field CurrencyCode
Compared to the case where a file location is available:
bash-3.2$ concerto generate --ctoFiles test/models/parseerror.cto
Expected "-->", "@", "default", "o", "optional", "}", comment, end of line, or whitespace but "e" found. File test/models/parseerror.cto line 14 column 1 ParseException: Expected "-->", "@", "default", "o", "optional", "}", comment, end of line, or whitespace but "e" found. File test/models/parseerror.cto line 14 column 1
The text was updated successfully, but these errors were encountered:
After some investigation, I found that in case of exceptions like IllegalModelException the file location is passed as a parameter in the constructor (here). This location is read from the location property of AST (here). If we can follow a similar approach for the exceptions mentioned in the issue, we can add file location there.
Is your feature request related to a problem? Please describe.
Most errors include location information, but validation and type not found errors do not.
Describe the solution you'd like
When validating a JSON instance against a model fails, provide location information for where the error occurred in the JSON instance.
When loading a model which has an unknown type, provide location information for where that type is used in the model.
Describe alternatives you've considered
I haven't.
Additional context
Here is an example of an exception with location information (it inherits from
BaseFileException
):https://github.com/accordproject/concerto/blob/master/packages/concerto-core/lib/introspect/parseexception.js
Currently when running the CLI in those cases:
Compared to the case where a file location is available:
The text was updated successfully, but these errors were encountered: