Skip to content

qtype convert module generates invalid type PrimitiveTypeEnum.text for optional parameters with defaults #136

@loukratz-bv

Description

@loukratz-bv

Description:

When converting a Python module with optional parameters that have default values, qtype convert module generates invalid type references like PrimitiveTypeEnum.text? instead of text?.

Reproduction:

Create a simple Python module:

# example_tools.py
def my_function(required_param: str, optional_param: str = "default") -> str:
    """Example function with optional parameter."""
    return f"{required_param}-{optional_param}"

Convert it:

qtype convert module example_tools -o output.yaml

Expected Output:

- inputs:
  - id: required_param
    type: text
  - id: optional_param
    type: text?

Actual Output:

- inputs:
  - id: required_param
    type: text
  - id: optional_param
    type: PrimitiveTypeEnum.text?

Impact:

The generated YAML fails validation:

❌ Validation Error: Invalid type reference 'PrimitiveTypeEnum.text?'

Root Cause:

The type conversion logic is incorrectly serializing the enum type for optional parameters instead of using the string value.

Workaround:

Manually edit the generated YAML to replace PrimitiveTypeEnum.text? with text?.

Metadata

Metadata

Assignees

No one assigned

    Labels

    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