Skip to content

🐞 dagger call doesn't use an enum's default value correctly #7999

@helderco

Description

@helderco

What is the issue?

Reported by Mike, in Discord.

When calling a Dagger Function with an enum as a parameter's default value, omitting its flag returns an error.

Using --debug I can confirm that the CLI is sending an empty string to the API:

# dagger call test-func
{
    enumDefault {
        testFunc(env: "")
    }
}

Dagger version

dagger v0.12.1 (registry.dagger.io/engine) darwin/arm64

Steps to reproduce

Create a simple module:

dagger init --sdk=python enum-default

With the following test example:

import dagger


@dagger.enum_type
class Env(dagger.Enum):
    """Environment the project will be run in"""

    DEV = "DEV"
    INT = "INT"
    TEST = "TEST"


@dagger.object_type
class EnumDefault:
    @dagger.function
    async def test_func(self, env: Env = Env.DEV) -> Env:
        return env

Call with:

dagger call test-func

Log output

Error: response from query: input: enumDefault.testFunc resolve: failed to convert arg "env": invalid enum value ""

Expected

DEV

Metadata

Metadata

Assignees

Labels

area/cliAll about go code on dagger CLIkind/bugSomething isn't working

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions