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

function: Consider Parameter-Based Validators #894

Closed
bflad opened this issue Dec 18, 2023 · 1 comment · Fixed by #971
Closed

function: Consider Parameter-Based Validators #894

bflad opened this issue Dec 18, 2023 · 1 comment · Fixed by #971
Labels
enhancement New feature or request
Milestone

Comments

@bflad
Copy link
Contributor

bflad commented Dec 18, 2023

Module version

v1.5.0 (not yet released)

Use-cases

Provider developers implementing a schema definition for a data source, resource, or provider can define attribute-based validators to define validation rules that should be ran against configuration values. It might be nice to offer the same for provider-defined function definitions, since each parameter should theoretically be able to do something similar. The main "challenge" here is that the attribute-based validator interfaces and implementations are named relatively towards schemas, e.g. in their package import naming.

Attempted Solutions

Manually implement value validation in provider-defined function logic (Run method), checking the value, adding any diagnostics, and returning early if necessary.

Proposal

Open to suggestions

Double check whether the existing validator interfaces are acceptable to also serve as interfaces for parameter-based validation.

Add Validators fields to function.Parameter implementations. Implement parameter-based validation in internal/fromproto5.ArgumentsData() and internal/fromproto6.ArgumentsData() by looping through the Validators.

References

@bflad bflad added the enhancement New feature or request label Dec 18, 2023
@austinvalle austinvalle added this to the v1.8.0 milestone Apr 15, 2024
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants