common-workflow-language / cwltool

Common Workflow Language reference implementation
https://cwltool.readthedocs.io/
Apache License 2.0
335 stars 230 forks source link

`cwltool --pack` generates IDs for enum symbols #1513

Open jdidion opened 3 years ago

jdidion commented 3 years ago

When I pack a conformance test that contains an enum type (e.g. https://github.com/common-workflow-language/cwl-v1.2/blob/main/tests/anon_enum_inside_array.cwl) the packed workflow turns the enum symbols into URI fragments. The symbols should not be modified.

{
    "class": "CommandLineTool",
    "inputs": [
        {
            "type": {
                "type": "record",
                "fields": [
                    {
                        "type": [
                            {
                                "type": "enum",
                                "symbols": [
                                    "#main/first/species/homo_sapiens",
                                    "#main/first/species/mus_musculus"
                                ]
                            },
                            "null"
                        ],
                        "name": "#main/first/species"
                    }
                ]
            },
            "id": "#main/first"
        },
        {
            "type": [
                "null",
                {
                    "type": "enum",
                    "symbols": [
                        "#main/second/homo_sapiens",
                        "#main/second/mus_musculus"
                    ]
                }
            ],
            "id": "#main/second"
        }
    ],
    "baseCommand": "echo",
    "arguments": [
        {
            "prefix": "first",
            "valueFrom": "$(inputs.first.species)"
        },
        {
            "prefix": "second",
            "valueFrom": "$(inputs.second)"
        }
    ],
    "outputs": [
        {
            "type": "File",
            "id": "#main/result",
            "outputBinding": {
                "glob": "4114671e652492b7e2f05b10178342c11c66195b"
            }
        }
    ],
    "id": "#main",
    "stdout": "4114671e652492b7e2f05b10178342c11c66195b",
    "cwlVersion": "v1.2"
}
YuxinShi0423 commented 2 years ago

https://github.com/common-workflow-lab/cwljava/search?q=uri_array_of_StringInstance_True_False_None The "symbols" field in all enum types is loaded using the URI loader "uri_array_of_StringInstance_True_False_None" (and this loader is only used for enum type), and the baseUri is added to the symbol strings. Would that be the cause for this issue? @jdidion Also it seems that the id of the optional enum passed to the enum as its "name"? https://github.com/common-workflow-lab/cwljava/pull/44