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

fix validator #43

Merged
merged 3 commits into from
Apr 25, 2024
Merged

fix validator #43

merged 3 commits into from
Apr 25, 2024

Conversation

aliotta
Copy link
Contributor

@aliotta aliotta commented Apr 25, 2024

Description

Fixes a bug in the validator used by the override spec

🎟 Issue(s)

🧪 Functional Testing

📸 Screenshots

📋 Checklist

  • Rebased from the main (or release if patching) branch (before testing)
  • Added/updated applicable tests
  • Added/updated examples in the examples/ directory
  • Tested against Astro-API
  • Communicated to/tagged owners of respective clients potentially impacted by these changes.
  • Updated any related documentation

@aliotta aliotta requested review from vandyliu, sunkickr and a team as code owners April 25, 2024 18:59
@@ -131,7 +131,7 @@ func HibernationOverrideResourceSchemaAttributes() map[string]resourceSchema.Att
"is_hibernating": resourceSchema.BoolAttribute{
Optional: true,
Validators: []validator.Bool{
boolvalidator.AlsoRequires(path.MatchRoot("override_until")),
boolvalidator.AlsoRequires(path.MatchRelative().AtParent().AtName("override_until")),
Copy link

Choose a reason for hiding this comment

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

do you mind explaining what these functions do and why it was broken before, sorry missing some context here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

at the parent of this param match an element by the provided name "override_until". Require that param if this param is provided.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

MatchRoot doesn't start at the parent but instead at the root of the object so "override_until" could not be found.

Copy link

@fredzhy fredzhy left a comment

Choose a reason for hiding this comment

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

only left one clarification question for my own understanding

@aliotta aliotta merged commit 97a5dcc into main Apr 25, 2024
4 of 5 checks passed
@aliotta aliotta deleted the fixValidatorOnOverrideSpec branch April 25, 2024 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants