-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat: added exception for reserved keywords #100
Conversation
Signed-off-by: Kailash Kejriwal <[email protected]>
Signed-off-by: Kailash Kejriwal <[email protected]>
This PR will add the feature to throw an exception if reserved keywords are used in a JSON schema. |
@@ -614,7 +638,10 @@ class JsonSchemaVisitor { | |||
}; | |||
|
|||
// Handle reserved properties. | |||
if (['$identifier', '$class', '$timestamp'].includes(propertyName)) { | |||
if (privateReservedProperties.includes(propertyName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution @kailash360 :). We already have a utility function for the check.
Please use this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, I have replaced them with the ModelUtil methods.
@stefanblaginov @mttrbrts can you please review this PR? |
Signed-off-by: Kailash Kejriwal <[email protected]>
Co-authored-by: jonathan-casey <[email protected]> Signed-off-by: Dan Selman <[email protected]>
Co-authored-by: jonathan-casey <[email protected]> Signed-off-by: Dan Selman <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Closes #48
It adds the feature to throw an exception if the JSON schema contains any reserved keyword. These reserved keywords are categorized into
private
- which is used internally by Concerto, andassignable
- which is used in serialization. Errors are thrown only if aprivate
keyword is encountered.Changes
Flags
N/A
Screenshots or Video
N/A
Related Issues
Author Checklist
--signoff
option of git commit.main
fromfork:branchname