koumoul-dev / vuetify-jsonschema-form

Create beautiful and low-effort forms that output valid data. Published on npm as @koumoul/vjsf.
https://koumoul-dev.github.io/vuetify-jsonschema-form/latest/
MIT License
538 stars 154 forks source link

Allow to display some properties of an object selected in an array #362

Open Martin-Idel opened 1 year ago

Martin-Idel commented 1 year ago

Description: Allow user to display informational properties of an object selected by one of its properties, i.e: I have an array select where I select an object by some property (e.g. its name) and I want to display other properties of the object to the user for informational purposes.

Use case: Sometimes your user can select an object from and it would be nice to display some other properties of that object just for informational purposes.

Think about the following scenario:

"array": {
  "type": "array",
  "title": "My array",
  "items": {
    "type": "object",
    "title": "My objects"
    "properties": {
      "object_name": {
        "type": "object",
        "x-fromData": "context.my_objects"
        "x-itemKey": "name"
        "properties": {
          "name": {
            "type": "string"
          },
          "additional_info": {
            "type": "string"
          },
          "other_additional_info": {
            "type": "string"
          },
        }
     }
  }
}

It seems reasonable to choose the object by name (as is done here) and then the whole object is added to the context with the properties as is. The only missing part is actually allowing to also display the other properties.