Skip to content
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(plugins): Add "unique_keys" in avdschema. #3725

Conversation

ClausHolbechArista
Copy link
Contributor

@ClausHolbechArista ClausHolbechArista commented Mar 8, 2024

Change Summary

Add "unique_keys" in avdschema.

Component(s) name

AVD Schema validation

Proposed changes

Support unique_keys in the AVD Meta schema so we can validate uniqueness of one or more keys which is not the primary_key.
Also supports checking uniqueness across nested data models by using dot-notated variable path.

Limitation: If the test for nested keys overlap with the primary_key of an underlying dict, it will emit errors from both checks. This should be solved by removing primary_key on the nested dict, and just set required: true on the key instead.

How to test

Added unit tests for both positive and negative cases.
Also tested manually with cv_pathfinder_regions where we want unique_keys: [name, sites.name" to ensure unique site names across multiple regions.

Checklist

User Checklist

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

@github-actions github-actions bot added the type: documentation Improvements or additions to documentation label Mar 8, 2024
@gmuloc gmuloc requested review from a team March 8, 2024 14:39
Copy link
Contributor

@gmuloc gmuloc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gmuloc gmuloc requested review from a team March 8, 2024 14:40
@gmuloc gmuloc added the one approval This PR has one approval and is only missing one more. label Mar 8, 2024
Copy link
Member

@carlbuchmann carlbuchmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
one approval This PR has one approval and is only missing one more. rn: Feat(plugins) type: documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants