Skip to content

Boolean in data-file #1951

Open
Open
@crenus

Description

@crenus

Describe the problem

Current problem i am facing is the passing of a boolean in a datafile. I have a jinja condition around creating a file, and when its false, it doesnt generate. I am using a data file for "test cases" that the template works. If i pass the value false in a data file, the template still creates the file.

If I change the template to check for the value of the input, it works but that would break the usage, cause one uses a string while the input should be a boolean if used by cli

Template

{% if include_echo_controller %}EchoController.java.jinja{% endif %}

And the data file just has:
include_echo_controller: false

And in copier.yml

include_echo_controller:
  type: bool
  default: false
  help: "Do you want to include the example EchoController?"

To Reproduce

No response

Logs

Expected behavior

I expect the parser to treat a boolean in a yaml file as such.

Screenshots/screencasts/logs

No response

Operating system

Linux

Operating system distribution and version

Ubuntu

Copier version

copier 9.4.0

Python version

3.14

Installation method

pip+git

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugtriageTrying to make sure if this is valid or not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions