Inquiries can be created with an empty schema
Open
@Mierdin is already working on this.
Since Nov 10, 2017.
inquiries
stale
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.