-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for custom annotation on Type reference #132
Comments
There is a workaround given in the related issue amazon-ion/ion-schema-kotlin#303 but I opened this issue to discuss the possibility of supporting this in ISL or if not then why it is not a good idea. |
Thanks for suggesting this feature. From an implementation perspective, it is certainly possible to allow other annotations on type references. I think the next step here is to determine the answers to at least these questions to help figure out how this fits with the rest of the Ion Schema Language.
|
Thanks for the response.
|
I have a usecase to extend
Type
to add some custom logic.For example, a new Type may have some fields which is mandatory but when comparing two instances of that type I'd like to ignore few fields. We can achieve this by annotating few fields with our custom annotation say
compare.ignore
and then parse the schema and have a list of fields to be ignored in Type and then while comparing we remove those ignored fields from both left and right before comparing.A corresponding schema may look something like:
But this fails as ISL doesn't allow any annotation other than some default annotations [1].
ISL itself is Ion doc and as any Ion doc it could support any custom annotation and have it behave as passthru and
.getIsl()
on type can return the type IonValue as it is along with any annotation and let the client handle that however they want.[1] https://github.com/amazon-ion/ion-schema-kotlin/blob/bbab678c12fdd07bcb9b5d632fb7364a04541a73/ion-schema/src/main/kotlin/com/amazon/ionschema/internal/TypeReference.kt#L58
A related issue: amazon-ion/ion-schema-kotlin#303
The text was updated successfully, but these errors were encountered: