-
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
Create an Ion Schema linter #60
Comments
If the proposed solutions for #44 and/or #51 are incorporated into Ion Schema 2.0, it would be good to have linter rules to warn when an argument for that constraint would be unsatisfiable. For example:
This can be further generalized to warn (for all type definitions) when conflicting constraints are present.
However, in all of these cases, one could argue that these should be invalid schemas instead of just eliciting a linter warning. |
It would be a good idea to try to write some linter rules as Ion Schema. It's not possible to have a complete check for satisfiability that is written in pure Ion Schema, but it is possible for the rule about having incompatible constraint types in a single type definition to be modeled in ISL. I believe that most (if not all) of the other proposed rules could be expressed in a linter variant of ion-schema-schemas. |
Another potentially useful linter rule—the upper and lower bound of a timestamp range should have the same offset (to avoid confusion). Or, even stricter, the linter could also require that all timestamp ranges be written in UTC (i.e. an offset of either |
Another potentially useful linter rule—some regexes are susceptible to catastrophic backtracking. It would be useful to have a way to identify and flag regex constraints that have susceptible patterns. Possibly useful references: |
It would be useful to have an opt-in tool to help enforce some best practices and avoid some common pitfalls. Individual rules should be able to be turned on or off.
Some possible linter rules, in no particular order:
any_of
,all_of
, andone_of
constraints should not have duplicate elements (see Clarify whether repeated type references are allowed for the sum-type constraints #53)valid_values
constraints should not have duplicate elements[a-zA-Z0-9_$]+
or names may not contain whitespace)The text was updated successfully, but these errors were encountered: