Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MiniWDL does not support map to struct coercion #712

Open
stxue1 opened this issue Aug 21, 2024 · 0 comments
Open

MiniWDL does not support map to struct coercion #712

stxue1 opened this issue Aug 21, 2024 · 0 comments
Labels
bug Something isn't working interop Bears on spec compatibility

Comments

@stxue1
Copy link

stxue1 commented Aug 21, 2024

The unit test in the WDL spec attempts to implicitly coerce a map to a struct:

version 1.1

struct Words {
  Int a
  Int b
  Int c
}

workflow map_to_struct {
  String a = "beware"
  String b = "key"
  String c = "lookup"

  output {
    # What are the keys to this Struct?
    Words literal_syntax = Words {
      a: 10,
      b: 11,
      c: 12
    }

    # What are the keys to this Struct?
    Words map_coercion = {
      a: 10,
      b: 11,
      c: 12
    }
  }
}

MiniWDL currently cannot run this workflow:

2024-08-21 14:58:50.630 wdl.w:map_to_struct workflow start :: name: "map_to_struct", source: "unit_tests/map_to_struct.wdl", line: 9, column: 1, dir: "/home/heaucques/Documents/wdl-conformance-tests/20240821_145850_map_to_struct"
2024-08-21 14:58:50.632 wdl.w:map_to_struct miniwdl :: version: "v1.12.0", uname: "Linux pop-os 6.9.3-76060903-generic #202405300957~1721174657~22.04~abb7c06 SMP PREEMPT_DYNAMIC Wed J x86_64"
2024-08-21 14:58:50.654 wdl.w:map_to_struct workflow map_to_struct (unit_tests/map_to_struct.wdl Ln 9 Col 1) failed :: dir: "/home/heaucques/Documents/wdl-conformance-tests/20240821_145850_map_to_struct", error: "EvalError", message: "unusable runtime struct initializer, missing non-optional member(s) in struct Words: a b c", node: "output-map_coercion", pos: {"source": "/home/heaucques/Documents/wdl-conformance-tests/unit_tests/map_to_struct.wdl", "line": 23, "column": 26}
2024-08-21 14:58:50.655 wdl.w:map_to_struct aborting workflow
2024-08-21 14:58:50.655 miniwdl-run unusable runtime struct initializer, missing non-optional member(s) in struct Words: a b c :: error: "EvalError", node: "output-map_coercion", pos: {"source": "/home/heaucques/Documents/wdl-conformance-tests/unit_tests/map_to_struct.wdl", "line": 23, "column": 26}, dir: "/home/heaucques/Documents/wdl-conformance-tests/20240821_145850_map_to_struct"

When parsing the workflow with MiniWDL's internals, while it is able to parse, the struct keys are not properly propagated (I first encountered this here).

Post parse, literal_syntax is equal to {'a': 'Int', 'b': 'Int', 'c': 'Int'} and map_coercion is equal to {'a': 'Int', 'b': 'Int', 'c': 'Int'}, instead of the expected value.

@mlin mlin added bug Something isn't working interop Bears on spec compatibility labels Nov 20, 2024
@mlin mlin added this to miniwdl Nov 20, 2024
@github-project-automation github-project-automation bot moved this to Backlog in miniwdl Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working interop Bears on spec compatibility
Projects
Status: Backlog
Development

No branches or pull requests

2 participants