Skip to content

Variable with boolean/number default value and choices will cause unhandled exception #81

@xinfli

Description

@xinfli

Create template.toml as below, it will pass validation:

name = "Test template"
description = "A description"
kickstart_version = 1

[[variables]]
name = "create_demo_data"
default = true
prompt = "Create demo data?"
choices = [true, false]

or

name = "Test template"
description = "A description"
kickstart_version = 1

[[variables]]
name = "demo_record_count"
default = 100
prompt = "How many demo data to be created?"
choices = [100, 150, 200]

But when try generate code with such template, it will fail with error:

Create demo data?:
thread 'main' panicked at src\cli\prompt.rs:88:74:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
How many demo data to be created?:
thread 'main' panicked at src\cli\prompt.rs:88:74:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected:

  • Should fail validation for such variable definition.
  • Since kickstart do not validate template before apply it, it's better to prompt choices for string variable only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions