Skip to content

[Feature]: JSON Schema Validator Function #441

@Gowiem

Description

@Gowiem

What functionality would you like to see?

My team and I have run into an issue a number of times with what I'm calling the "Optional Type Defaults Problem" (bad name). Lots of info in the OpenTofu Slack. The quick summary: when merging objects with optional fields, there can be null values that unintentionally override desired defaults. This leads to unexpected / undesired behavior in complex module configurations.

The end result of this issue is that we can't use the TF type system to do what we want and instead we're going to specify any as our type for complex objects in certain cases and then we'll use a JSON schema to validate the given variable value at runtime. To do this today, we're thinking about using the jsonschema_validator data source from the jsonschema providera. However that is an old, seemingly unpopular provider and the validation is not implemented as a function.

I would love to see a str_jsonschema_validate function in this provider. If there is interest, I can try to put up a PR to add this.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions