InseeFrLab / onyxia

🔬 Data science environment for k8s

Home Page:https://onyxia.sh

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enhance json schema support : array

fcomte opened this issue · comments

commented

We should support array :
Items is the specification of one element in the list..

This helm chart implements this schema :

        "extraEnvVars": {
            "type": "array",
            "title": "Array of Environment Variables",
            "description": "A list of environment variables, where each variable includes a name and a value.",
            "default:": [
               {
                 "name": "My name",
                 "value": "My value"
               }
            ],
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "The name of the environment variable."
                },
                "value": {
                  "type": "string",
                  "description": "The value of the environment variable."
                }
              },
              "required": ["name", "value"],
              "additionalProperties": false
            }
        },
commented

If items is not set we can keep our actual implementation with [] inside a textArea.

If items is set we can show the default value (if exist) inside the UI component that match the item ( as all type of field have their representation ). If there is no default there is two choices :

  • we can provide an empty object ( no need to click on a + button to add one object to the list ). But If you do this we can't know if the sent object should be : extraEnvVars : [ ] or extraEnvVars : [ { name: "", value: "" } ]
  • provide nothing and let user click on a + button can add this semantic.
    I prefer the first for the UX but the second for a generic approach.

We can ignore "required" and "additionalProperties" for this first step (they are supposed to false in our imlementation at the moment