-
Notifications
You must be signed in to change notification settings - Fork 9.5k
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
helper/schema: remove outdated ValidateFunc restrictions #22298
helper/schema: remove outdated ValidateFunc restrictions #22298
Conversation
Validation on non-primitives has possibly worked for several years - see initial commit in 2a179d1, and subsequent blames associated with respective lines in functions validateType, validateList, and validatePrimitive. For some reason though, we've never removed the restriction from internalValidate. This commit removes it, in addition to fixing the specific test case, which was giving a false positive on the validation error as it was missing the Elem attribute for TypeSet.
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.
👋
I'm a little bit worried about "opening the flood gates" without more thorough testing. I'm sure this works well for simple cases like set/list of strings (as demonstrated in the modified test), or other primitive types, but I'm not sure we have the right SDK API in place to provide any reasonable UX for validating deeply nested structures, i.e. cases where Elem
is not a primitive type.
Technically it should just work, but I'd rather not expand the surface of the SDK for now, especially after the 0.12 work, which has left parts of this package practically untested.
For these reasons I'm tempted to close the PR, but I'm sure it's something we'd want to address eventually as part of our future work on the SDK, when we get to a point of better test coverage and feel safer to introduce such changes.
Hey Radek, This is a fair concern. Maybe we can compromise and allow it on primitive element types but not nested ones? PS: It should be noted that the only thing preventing someone from using |
@radeksimko if you could weigh in on hashicorp/terraform-provider-tfe#86 (comment) that'd be great, as I'm kind of confused how what @lafentres is doing is working if we are still restricting this in |
I'm going to close this. As per the aforementioned thread, this works just fine if you add the |
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. |
Validation on non-primitives has possibly worked for several years -
see initial commit in 2a179d1, and subsequent blames associated with
respective lines in functions validateType, validateList, and
validatePrimitive.
For some reason though, we've never removed the restriction from
internalValidate.
This commit removes it, in addition to fixing the specific test case,
which was giving a false positive on the validation error as it was
missing the Elem attribute for TypeSet.