Using `bool` parameter values not intuitive

Open
#94 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go
Domain
backend

Research direction

Start with the coder_parameter handling for type "bool" and reproduce the Terraform example using data.coder_parameter.ai.value. Determine whether string values such as "true" should become booleans or produce a warning; done means the behavior is consistent with the documented expectation and covered by a regression test.

Written by the indexing model from the issue text.

Description

documentation

This does not behave as expected because the value is the string literal"true", not the boolean value true. This should be made more intuitive, or throw a warning?

data "coder_parameter" "ai" {
  name        = "ai"
  display_name = "Use AI?"
  description = "Do you want to use AI for this workspace?"
  type        = "bool"
  form_type   = "checkbox"
  default = false
  order       = 0
}

data "coder_parameter" "ai_prompt" {
  count = data.coder_parameter.ai.value == true ? 1 : 0 
  name        = "prompt"
  display_name = "Prompt"
  description = ""
  type        = "string"
  form_type   = "textarea"
  default = ""
  styling = jsonencode({
    placeholder = "hello world"
  })
}
Dominant language
Go
Stars
9
Forks
5
Avg merge
5d 17h
Merged PRs (30d)
5

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from coder/preview

All issues in coder/preview

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.