Skip to content

feat: support custom validation errors for number-typed parameters #12224

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

Merged
merged 9 commits into from
Feb 20, 2024

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Feb 20, 2024

Fixes: #12192

This PR modifies coderd, site, and CLI to support custom validation errors. Fortunately, this PR is relatively small.

Template preview:

data "coder_parameter" "foobar_1" {
  name         = "foobar_1"
  display_name = "Foobar 1"
  type         = "number"
  description  = "Let's set the foobar."
  default      = "3"
  mutable      = true
  validation {
    min   = 3
    max   = 5
    error = "This is custom error {min}, {max}, {value}."
  }
}

@mtojek mtojek self-assigned this Feb 20, 2024
@mtojek mtojek marked this pull request as ready for review February 20, 2024 14:01
Copy link
Collaborator

@BrunoQuaresma BrunoQuaresma left a comment

Choose a reason for hiding this comment

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

Just a nit comment. 👍 for the tests

Copy link
Member

@johnstcn johnstcn left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@mtojek mtojek merged commit 57bf997 into main Feb 20, 2024
@mtojek mtojek deleted the 12192-number-error branch February 20, 2024 15:32
@github-actions github-actions bot locked and limited conversation to collaborators Feb 20, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat: support custom error message for number-typed coder parameters
3 participants