Skip to content

[Ballerina][MI] Improve record type UX #4533

@thuva9872

Description

@thuva9872

Description

Currently, a record type is supported only as a single input field.
Example:

public type Person record {
    string first_name;
    string last_name;
    int age;
};

In MI, this gets generated as a single attribute expecting the user to manually provide JSON input:

{
  "type": "attribute",
  "value": {
    "name": "person",
    "displayName": "person",
    "inputType": "stringOrExpression",
    "defaultValue": "",
    "required": "true",
    "helpTip": "",
    "validateType": "",
    "matchPattern": ""
  }
}

This breaks the low-code experience because the user must manually construct a JSON payload for the record structure (e.g., { "first_name": "...", "last_name": "...", "age": ... }).
Instead, the user should be able to fill in record fields individually without writing JSON.

Record types should expose each field as a separate input attribute, while still supporting JSON as an optional combined input.

Example of expected generated attributes:

[
  {
    "type": "attribute",
    "value": {
      "name": "personInputType",
      "displayName": "Person Input Type",
      "inputType": "combo",
      "defaultValue": "SINGLE",
      "comboValues": ["JSON", "SINGLE"],
      "required": "true",
      "helpTip": "",
      "validateType": "",
      "matchPattern": ""
    }
  },
  {
    "type": "attribute",
    "value": {
      "name": "person",
      "displayName": "person (JSON)",
      "inputType": "stringOrExpression",
      "defaultValue": "",
      "required": "true",
      "helpTip": "",
      "validateType": "",
      "matchPattern": "",
      "enableCondition":{"personInputType":"JSON"}
    }
  },
  {
    "type": "attribute",
    "value": {
      "name": "first_name",
      "displayName": "First Name",
      "inputType": "stringOrExpression",
      "defaultValue": "",
      "required": "true",
      "helpTip": "",
      "validateType": "",
      "matchPattern": ""
      "enableCondition":{"personInputType":"JSON"}
    }
  },
  {
    "type": "attribute",
    "value": {
      "name": "last_name",
      "displayName": "Last Name",
      "inputType": "stringOrExpression",
      "defaultValue": "",
      "required": "true",
      "helpTip": "",
      "validateType": "",
      "matchPattern": ""
      "enableCondition":{"personInputType":"JSON"}
    }
  },
  {
    "type": "attribute",
    "value": {
      "name": "age",
      "displayName": "Age",
      "inputType": "stringOrExpression",
      "defaultValue": "",
      "required": "true",
      "helpTip": "",
      "validateType": "",
      "matchPattern": ""
      "enableCondition":{"personInputType":"JSON"}
    }
  }
]

Version

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions