-
Notifications
You must be signed in to change notification settings - Fork 18
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: add schema_version
key to groups for calculated yaml definitions
#52
Conversation
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.
PR Overview
This PR introduces a new optional key, schema_version, to YAML definitions for calculated groups. The changes include adding schema_version to sample YAML fixtures, implementing its retrieval and validation in the Ruby code, and adding tests to verify valid, default, and error cases.
Changes
File | Description |
---|---|
spec/unit/fixtures/ldap-config/filters/no-filters-with-schema-version.yaml | Adds a YAML fixture with a valid schema_version value |
spec/unit/fixtures/ldap-config/filters/no-filters-with-schema-version-with-v.yaml | Adds a YAML fixture with a schema_version value that has a leading 'v' to test error handling |
lib/entitlements/data/groups/calculated/yaml.rb | Implements schema_version method with semver validation and default fallback |
spec/unit/entitlements/data/groups/calculated/yaml_spec.rb | Introduces tests for valid, default, and invalid schema_version formats |
spec/unit/fixtures/ldap-config/filters/no-filters-with-bad-schema-version.yaml | Adds a YAML fixture with a malformed schema_version to trigger error handling |
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (2)
lib/entitlements/data/groups/calculated/yaml.rb:45
- [nitpick] Consider updating the error message to explicitly indicate that version strings with a 'v' prefix (e.g., 'v1.2.3') are not accepted, making the error more informative for users.
unless version.match?(\A\d+\.\d+\.\d+\z)
spec/unit/entitlements/data/groups/calculated/yaml_spec.rb:45
- [nitpick] Consider rewording this test description to clearly indicate that a version string with a 'v' prefix is expected to raise an error due to an invalid format.
it "returns the version string when one is set (with v prefix - not valid semver 2)" do
Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more
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.
@GrantBirki you also need to bump the version of this gem 😸 |
schema_version
This pull request updates the calculated groups logic to add a new key called
schema_version
to yaml file definitions.This new attribute is optional and if unset it will default to
entitlements/v1
.Example