Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

config.json crash when have multiples conditional variables #873

Closed
yanBrandao opened this issue Feb 23, 2021 · 4 comments · Fixed by #884
Closed

config.json crash when have multiples conditional variables #873

yanBrandao opened this issue Feb 23, 2021 · 4 comments · Fixed by #884
Labels
🪲 bug Report a bug encountered while operating Ritchie
Milestone

Comments

@yanBrandao
Copy link

yanBrandao commented Feb 23, 2021

Hi folks, I did a little complex menu for my automation, with many conditional parameters and when I choose an alternative option, I got this error:

What happened:

Error: config.json: conditional variable rit_pizza_option not found

What you expected to happen:

Should continue alternative menu without crash

How to reproduce it (as minimally and precisely as possible):
I'm sharing with u my config.json and a mind map with menu flow, and options to get the crash.

image

For details explanation, when Bring me a Pizza is selected, it works like a charm, because the second menu option related to favorite pizza and address have "rit_pizza_option" variable filled.
But when Give me a Drink is selected, even with all variables with default value it doens't work.

Here my config.json:

{
  "dockerImageBuilder": "ritclizup/rit-kotlin-jdk8-builder",
  "inputs": [
    {
      "label": "Wellcome to Pizza Planet :D ",
      "name": "rit_menu_option",
      "default": "Bring me a Pizza",
      "required": false,
      "items": [
        "Bring me a Pizza",
        "Give me a Drink"
      ],
      "type": "text"
    },
    {
      "cache": {
        "active": true,
        "qty": 15,
        "newLabel": "Enter a new name:"
      },
      "condition": {
        "variable": "rit_menu_option",
        "operator": "==",
        "value": "Bring me a Pizza"
      },
      "label": "Enter your name: ",
      "name": "rit_pizza_client",
      "default": "Yan",
      "required": false,
      "type": "text"
    },
    {
      "condition": {
        "variable": "rit_menu_option",
        "operator": "==",
        "value": "Bring me a Pizza"
      },
      "label": "Choose one of the options: ",
      "name": "rit_pizza_option",
      "default": "Enter an address",
      "items": [
        "Enter an address",
        "Define favorite pizza"
      ],
      "required": false,
      "type": "text"
    },
    {
      "condition": {
        "variable": "rit_pizza_option",
        "operator": "==",
        "value": "Define favorite pizza"
      },
      "label": "Tell us the pizza that you love: ",
      "name": "rit_pizza_favorite",
      "default": "Calabresa",
      "required": false,
      "type": "text"
    },
    {
      "condition": {
        "variable": "rit_menu_option",
        "operator": "==",
        "value": "Give me a Drink"
      },
      "label": "Pick your drink ",
      "name": "rit_drink_option",
      "items": [
        "Coke",
        "Orange Juice"
      ],
      "default": "Coke",
      "required": false,
      "type": "text"
    }
  ]
}

What I've done to solve this problem:

Tried to set a default value for every variable in config.json

Environment:

  • Ritchie version (use rit --version): 2.9.1
  • Operating System: Ubuntu
@GuillaumeFalourd
Copy link
Contributor

Hi @yanBrandao, thank you for opening this ISSUE! 🚀

What happened when you set the default values for the variables in the config.json file?
Did the CLI returned the same error message?

@GuillaumeFalourd GuillaumeFalourd added 🪲 bug Report a bug encountered while operating Ritchie waiting reply Waiting for an answer to a comment 🔨 improvement Improvement in features labels Feb 23, 2021
@yanBrandao
Copy link
Author

@GuillaumeFalourd yes, I don't know if I used default parameter has need to be, but if you see all variables in this config.json have default value and returned the same error.

@henriquemoraeszup
Copy link
Contributor

Hi Brandao! Thanks for the feedback, we will be looking into it

@yanBrandao
Copy link
Author

@henriquemoraeszup and @GuillaumeFalourd thanks for resolution I'm excited for the next release! \o/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🪲 bug Report a bug encountered while operating Ritchie
Projects
None yet
3 participants