viash-io / viash

script + metadata = standalone component
https://viash.io
GNU General Public License v3.0
39 stars 2 forks source link

validate yaml configs #62

Closed rcannood closed 3 years ago

rcannood commented 3 years ago

circe doesn't validate non-existing fields in the yaml config by default. For example:

functionality:
  name: test
  4rguments:
    - name: "input"
      type: string
  resources:
    - type: bash_script
      text: echo $par_input
      dest: script.sh

When running the following command, viash doesn't throw an error or warning:

$ viash run config.vsh.yaml -- hello

$ viash run config.vsh.yaml -- -h
test <not versioned>

Options:

Apparently this can be solved with the .withStrictDecoding configuration (circe/circe#1117).

rcannood commented 3 years ago

Wow, that was easy (1dd27f5d8f4e76126972c43c2a2d8c9e07f2574f).

$ viash run test/config.vsh.yaml -- -h
Exception in thread "main" DecodingFailure(Unexpected field: [4rguments]; valid fields: name, namespace, version, authors, arguments, resources, description, usage, function_type, tests, info, dummy_arguments, set_wd_to_resources_dir, List(DownField(functionality)))