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

filter: Improve validation of expression #848

Conversation

jacobbednarz
Copy link
Member

While making changes to filters you need to run apply to actually find
out whether the expression is valid. This is a slow feedback cycle for
developers and there is an API endpoint that allows you to validate
expressions before using them so it's a no brainer to improve the
validation in the schema.

This updates the ValidateFunc for expression to call out to the
validation API endpoint and raise those exceptions earlier in the
development cycle.

Fixes #846

While making changes to filters you need to run `apply` to actually find
out whether the expression is valid. This is a slow feedback cycle for
developers and there is an API endpoint that allows you to validate
expressions before using them so it's a no brainer to improve the
validation in the schema.

This updates the `ValidateFunc` for `expression` to call out to the
validation API endpoint and raise those exceptions earlier in the
development cycle.

Fixes cloudflare#846
@jacobbednarz jacobbednarz force-pushed the validate-filter-expression-in-schema branch from a1e3bf2 to 20dc090 Compare October 28, 2020 00:39
@jacobbednarz jacobbednarz merged commit 55cf727 into cloudflare:master Oct 28, 2020
@jacobbednarz jacobbednarz deleted the validate-filter-expression-in-schema branch October 28, 2020 02:05
jacobbednarz added a commit to jacobbednarz/terraform-provider-cloudflare that referenced this pull request Nov 5, 2020
cloudflare#848 introduced better validation for filters using the Terraform
schema. Despite handling the error, the error wasn't returned to the end
user and instead the RPC exception is shown the end user.

```
Error: rpc error: code = Unavailable desc = transport is closing
```

This fixes the user experience by returning the errors which now passes
the exception onto the end user instead of swallowing it or causing a
panic.
jacobbednarz added a commit to jacobbednarz/terraform-provider-cloudflare that referenced this pull request Nov 5, 2020
cloudflare#848 introduced better validation for filters using the Terraform
schema. Despite handling the error, the error wasn't returned to the end
user and instead the RPC exception is shown the end user.

```
Error: rpc error: code = Unavailable desc = transport is closing
```

This fixes the user experience by returning the errors which now passes
the exception onto the end user instead of swallowing it or causing a
panic.
jacobbednarz added a commit to jacobbednarz/terraform-provider-cloudflare that referenced this pull request Nov 5, 2020
Due to the endpoint not supporting API tokens, we needed to build a
standalone client which hasn't worked out well and the workarounds to
fix it are against the grain of how the Terraform schema is intended to
be used leaving us in situation where change in upstream functionality
may force us to be on an older version of the SDK if we were to
continue. Instead, this reverts cloudflare#848 and cloudflare#860 and once API token support
is added to the endpoint, we can reintroduce this without a standalone
client.

Closes cloudflare#861
jacobbednarz added a commit that referenced this pull request Nov 1, 2021
While making changes to filters you need to run apply to actually find
out whether the expression is valid. This is a slow feedback cycle for
developers and there is an API endpoint that allows you to validate
expressions before using them so it's a no brainer to improve the
validation in the schema.

This updates the ValidateFunc for expression to call out to the
validation API endpoint and raise those exceptions earlier in the
development cycle.

Take 2 of #848 now that API tokens are supported in the routes.

Closes #846
jacobbednarz added a commit that referenced this pull request Nov 1, 2021
While making changes to filters you need to run apply to actually find
out whether the expression is valid. This is a slow feedback cycle for
developers and there is an API endpoint that allows you to validate
expressions before using them so it's a no brainer to improve the
validation in the schema.

This updates the ValidateFunc for expression to call out to the
validation API endpoint and raise those exceptions earlier in the
development cycle.

Take 2 of #848 now that API tokens are supported in the routes.

Closes #846
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.

Add verification of filter size
1 participant