Repository navigation
Conversation
…closes accordproject#1649) Signed-off-by: Shreyansh Giri <girilakshmi91@gmail.com>
|
Thanks for this pull request, Shawnn08. Switching the Map validation errors in ResourceValidator to ValidationException brings them in line with the other validators, and the updated tests assert the exception type, which makes the change easy to check. Jonathan Casey, Jamie Shorten and Ertugrul Karademir have been asked to review. A maintainer will go through the change and reply on this thread. Thank you for the contribution. Posted automatically by Mira, an Accord Project agent. A maintainer will follow up; they make the decisions on this. |
There was a problem hiding this comment.
Thanks, Shawnn08. This does what #1649 asks: map type violations in checkMapType and visitMapDeclaration now throw ValidationException (still an Error, so existing catch blocks keep working), and the JSON.stringify fallback stops a circular value from hiding the real error. Dropping isFinite from the Integer/Long check is safe, since Number.isInteger already rejects NaN and Infinity. The tests assert the new type, cover non-Map input including null and undefined, and check instanceof Error. I found nothing that needs changing, and CI is green. It now needs a maintainer's approval.
No problems found.
Automated review by Mira, an Accord Project agent, at 7a6d4cd. Findings are labelled blocking, should-fix or nit; a maintainer makes the final call.
Closes #1649
Ensures that
ResourceValidator.visitMapDeclarationandResourceValidator.checkMapTypethrowValidationExceptioninstead of genericErrorwhen validating Map keys, values, and instance types.Changes
throw new Error(...)withthrow new ValidationException(...)across all map data type branches (String,DateTime,Boolean,Integer,Long,Double) incheckMapType.throw new Error(...)withthrow new ValidationException(...)invisitMapDeclarationwhen input is not an instance ofMap.try/catcharoundJSON.stringify(obj)invisitMapDeclarationfalling back toString(obj)to safely handle circular objects orBigInt.!isFinite(value)check inInteger/Longvalidation sinceNumber.isIntegeralready excludes non-finite values.test/serializer/maptype/serializer.jsandtest/serializer/resourcevalidator.jsto assertValidationException.test/serializer/resourcevalidator.jsverifying that non-Map objects (null,undefined,{},{ a: 1 }) throwValidationException.ValidationException instanceof Error.Flags
ValidationExceptioninherits fromBaseFileExceptionwhich extendsError, so existing consumer code withcatch (err)orerr instanceof Errorremains unaffected.Screenshots or Video
N/A (Backend serialization logic and tests)
Related Issues
Author Checklist
--signoffoption of git commit.mainfromfork:branchname