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

Report model and value being checked #862

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mvdbeek
Copy link
Contributor

@mvdbeek mvdbeek commented Aug 27, 2024

This gxformat2 document has a wrong type on the max of a float parameter.

class: GalaxyWorkflow
doc: |
  Simple workflow that no-op cats a file.
inputs:
  the_input:
    type: File
    doc: input doc
  the_collection:
    type: collection
    collection_type: list
  the_integer:
    type: int
    min: 1
    max: 3
  the_float:
    type: float
    min: 1.0
    max: 3.0a
outputs:
  the_output:
    outputSource: cat/out_file1
steps:
  cat:
    tool_id: cat1
    doc: cat doc
    in:
      input1: the_input

Before:

.. ERROR: Validation failed schema/v19_09/examples/valid1.yml:1:1:   Object `valid1.yml` is not valid because:
schema/v19_09/examples/valid1.yml:4:1:     the `inputs` field is not valid because:
                                            array item is invalid because
schema/v19_09/examples/valid1.yml:15:3:       checking object `valid1.yml#the_float`
                                                * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:18:5:           the `max` field is not valid because:
                                                    Value is a str, but valid types for this field
                                                    are (int, float)
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:18:5:           * the `max` field is not valid because:
                                                    Value is a str, but valid types for this field
                                                    are (int, float)
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Expected one of ('integer', 'int')
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Value is a str, but valid values for this field
                                                    are ("File", "data")
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Expected one of ('collection',)
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`

After:

.. ERROR: Validation failed schema/v19_09/examples/valid1.yml:1:1:   Object `valid1.yml` is not valid because:
schema/v19_09/examples/valid1.yml:4:1:     the `inputs` field with value `ordereddict([('the_input',
                                          ordereddict([('type', 'File'), ('doc', 'input doc')])),
                                          ('the_collection', ordereddict([('type', 'collection'),
                                          ('collection_type', 'list')])), ('the_integer',
                                          ordereddict([('type', 'int'), ('min', 1), ('max', 3)])),
                                          ('the_float', ordereddict([('type', 'float'), ('min', 1.0),
                                          ('max', '3.0a')]))])` is not valid because:
                                            array item is invalid because
schema/v19_09/examples/valid1.yml:15:3:       checking object `valid1.yml#the_float` using
                                              `WorkflowInputParameterLoader`
                                                * checking object `valid1.yml#the_float` using
                                                `WorkflowTextParameter`
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowFloatParameter`
schema/v19_09/examples/valid1.yml:18:5:           the `max` field is not valid because:
                                                    Value `3.0a` is a str, but valid types for this
                                                    field are (float, int)
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowIntegerParameter`
schema/v19_09/examples/valid1.yml:18:5:           * the `max` field is not valid because:
                                                    Value `3.0a` is a str, but valid types for this
                                                    field are (float, int)
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field with value `float` is not
                                                  valid because:
                                                    Expected one of ('integer', 'int')
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowDataParameter`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Value `float` is a str, but valid values for
                                                    this field are ("data", "File")
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowCollectionParameter`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field with value `float` is not
                                                  valid because:
                                                    Expected one of ('collection',)
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`

I don't know if we like the top level dictionary dump there, but in terms of understanding why a document didn't validate I find the after version much easier to understand.

@mr-c mr-c force-pushed the improve_validation_reporting branch from 86a81b7 to b3abc4c Compare September 5, 2024 14:38
This gxformat2 document has a wrong type on the max of a float
parameter.
```
class: GalaxyWorkflow
doc: |
  Simple workflow that no-op cats a file.
inputs:
  the_input:
    type: File
    doc: input doc
  the_collection:
    type: collection
    collection_type: list
  the_integer:
    type: int
    min: 1
    max: 3
  the_float:
    type: float
    min: 1.0
    max: 3.0a
outputs:
  the_output:
    outputSource: cat/out_file1
steps:
  cat:
    tool_id: cat1
    doc: cat doc
    in:
      input1: the_input
```

Before:
```
.. ERROR: Validation failed schema/v19_09/examples/valid1.yml:1:1:   Object `valid1.yml` is not valid because:
schema/v19_09/examples/valid1.yml:4:1:     the `inputs` field is not valid because:
                                            array item is invalid because
schema/v19_09/examples/valid1.yml:15:3:       checking object `valid1.yml#the_float`
                                                * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:18:5:           the `max` field is not valid because:
                                                    Value is a str, but valid types for this field
                                                    are (int, float)
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:18:5:           * the `max` field is not valid because:
                                                    Value is a str, but valid types for this field
                                                    are (int, float)
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Expected one of ('integer', 'int')
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Value is a str, but valid values for this field
                                                    are ("File", "data")
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Expected one of ('collection',)
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
```

After:
```
.. ERROR: Validation failed schema/v19_09/examples/valid1.yml:1:1:   Object `valid1.yml` is not valid because:
schema/v19_09/examples/valid1.yml:4:1:     the `inputs` field with value `ordereddict([('the_input',
                                          ordereddict([('type', 'File'), ('doc', 'input doc')])),
                                          ('the_collection', ordereddict([('type', 'collection'),
                                          ('collection_type', 'list')])), ('the_integer',
                                          ordereddict([('type', 'int'), ('min', 1), ('max', 3)])),
                                          ('the_float', ordereddict([('type', 'float'), ('min', 1.0),
                                          ('max', '3.0a')]))])` is not valid because:
                                            array item is invalid because
schema/v19_09/examples/valid1.yml:15:3:       checking object `valid1.yml#the_float` using
                                              `WorkflowInputParameterLoader`
                                                * checking object `valid1.yml#the_float` using
                                                `WorkflowTextParameter`
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `type`,
                                                  `regex`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowFloatParameter`
schema/v19_09/examples/valid1.yml:18:5:           the `max` field is not valid because:
                                                    Value `3.0a` is a str, but valid types for this
                                                    field are (float, int)
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowIntegerParameter`
schema/v19_09/examples/valid1.yml:18:5:           * the `max` field is not valid because:
                                                    Value `3.0a` is a str, but valid types for this
                                                    field are (float, int)
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field with value `float` is not
                                                  valid because:
                                                    Expected one of ('integer', 'int')
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowDataParameter`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field is not valid because:
                                                    Value `float` is a str, but valid values for
                                                    this field are ("data", "File")
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`
schema/v19_09/examples/valid1.yml:15:3:         * checking object `valid1.yml#the_float` using
                                                `WorkflowCollectionParameter`
schema/v19_09/examples/valid1.yml:16:5:           * the `type` field with value `float` is not
                                                  valid because:
                                                    Expected one of ('collection',)
schema/v19_09/examples/valid1.yml:17:5:           * invalid field `min`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
schema/v19_09/examples/valid1.yml:18:5:           * invalid field `max`, expected one of: `label`,
                                                  `doc`, `id`, `default`, `position`, `optional`, `format`,
                                                  `type`, `collection_type`
```

I don't know if we like the top level dictionary dump there, but in terms of
understanding why a document didn't validate I find the after version
much easier to understand.
@mr-c mr-c force-pushed the improve_validation_reporting branch from b3abc4c to 1f6f795 Compare September 5, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant