Skip to content

Inquiries can be created with an empty schema #3846

Open
@Mierdin

Description

@Mierdin

Right now, Inquiries can be defined with an empty schema:

version: '2.0'

examples.mistral-ask-basic:
    description: A basic Mistral workflow illustrating the use of Inquiries
    type: direct
    output:
        result: <% task(task1).result.response %>
    tasks:
        task1:
            action: core.ask
            input:
              route: developers
              schema: {}

Since there are no properties to iterate over, at a minimum this causes issues at respond time:

(virtualenv) vagrant@st2dev:~/st2$ st2 inquiry get 5a05626b32ed3550e323c7a3
+----------+--------------------------+
| Property | Value                    |
+----------+--------------------------+
| id       | 5a05626b32ed3550e323c7a3 |
| roles    |                          |
| users    |                          |
| route    | developers               |
| ttl      | 1440                     |
| schema   |                          |
+----------+--------------------------+
(virtualenv) vagrant@st2dev:~/st2$ st2 inquiry respond 5a05626b32ed3550e323c7a3
ERROR: 'NoneType' object is not iterable

I can get the inquiry to pass using the -r option but the client still breaks:

(virtualenv) vagrant@st2dev:~/st2$ st2 inquiry respond 5a05626b32ed3550e323c7a3 -r {}
ERROR: 'properties'

We should add some logic into the inquirer runner to perform some sanity checks on a user-provided schema to ensure some things:

  • Isn't empty
  • Defines an object with properties
  • Those properties don't define further objects (no nesting)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions