feat: add schema_version key to groups for calculated yaml definitions#52
Merged
GrantBirki merged 11 commits intomainfrom Feb 21, 2025
Merged
feat: add schema_version key to groups for calculated yaml definitions#52GrantBirki merged 11 commits intomainfrom
schema_version key to groups for calculated yaml definitions#52GrantBirki merged 11 commits intomainfrom
Conversation
There was a problem hiding this comment.
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
nobe4
reviewed
Feb 20, 2025
nobe4
reviewed
Feb 20, 2025
Member
|
@GrantBirki you also need to bump the version of this gem 😸 |
northrup
approved these changes
Feb 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

schema_versionThis pull request updates the calculated groups logic to add a new key called
schema_versionto yaml file definitions.This new attribute is optional and if unset it will default to
entitlements/v1.Example