-
Notifications
You must be signed in to change notification settings - Fork 72
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
Semantic validations #160
Semantic validations #160
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Trends 🧪 |
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.
I left a couple of questions/ideas in comments. The idea is great as it's much simpler than building a dedicated AST.
We need to remember that it will produce additional technical debt on porting the validator to other languages (but it's acceptable).
As this PR changes interfaces for package-spec, which approach is better:
- Push this PR to master, then to elastic-package, and integrations (I assume you'll have to fix some packages) and then iterate on new rules.
- Push this PR to master, add more rules (at least the TODO one) and then push everything further.
code/go/internal/validator/semantic/kibana_matching_object_ids.go
Outdated
Show resolved
Hide resolved
Agreed. This is why I created a new Golang package, BTW, I think we have a similar issue with the format checkers implementation. Maybe we should move all format checker code into this |
I think option 1 is better, especially since there may be fixes to some integrations packages as a result. That way the PR to Later we can similarly make a second set of PRs for the second semantic validation rule (the one marked as TODO in this PR). |
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.
BTW, I think we have a similar issue with the format checkers implementation. Maybe we should move all format checker code into this semantic package as well? WDYT?
SGTM, you can open an issue to refactor them too or modify in one next PRs (up to you).
Okay, I will do this in a follow up PR soon after this one is merged. |
What does this PR do?
This PR introduces semantic validations to the Package Spec. Semantic validations are validations of the package spec that cannot be achieved simply by adding declarative rules to the package spec, but instead may require some amount of programming to express the rules.
To demonstrate how semantic validations can be written, this PR implements the following semantic validation rule:
A follow up PR will implement a second semantic validation rule:
Why is it important?
To enforce semantic constraints on package elements.
Checklist
test/packages
that prove my change is effective.I have added an entry inThere is no change to the spec.versions/N/changelog.yml
.Related issues