Skip to content

Please align the JSON output of board list and board list watch #2010

Closed
@dankeboy36

Description

@dankeboy36

Describe the problem

Please align the props in the output of the board list --format json and board list --watch --format json commands. They're different. It does not cause any problems, and maybe it's by design, but I am using the gRPC API, mock my request responses from JSON from the CLI output, and do not understand the difference between them:

message BoardListWatchResponse {
// Event type as received from the serial discovery tool
string event_type = 1;
// Information about the port
DetectedPort port = 2;
// Eventual errors when detecting connected boards
string error = 3;
}

{
  "type": "add",
  "address": "/dev/cu.usbmodem14101",
  "label": "/dev/cu.usbmodem14101",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x0043",
    "serialNumber": "75830303934351618212",
    "vid": "0x2341"
  },
  "boards": [
    {
      "name": "Arduino Uno",
      "fqbn": "arduino:avr:uno"
    }
  ]
}

I understand that the --format json output of a command cannot always be the same as the JSON of gRPC request/response, but why not keep them the same if feasible? Thanks!

To reproduce

./arduino-cli board list --format json
[
  {
    "port": {
      "address": "/dev/cu.Bluetooth-Incoming-Port",
      "label": "/dev/cu.Bluetooth-Incoming-Port",
      "protocol": "serial",
      "protocol_label": "Serial Port"
    }
  },
  {
    "matching_boards": [
      {
        "name": "Arduino Uno",
        "fqbn": "arduino:avr:uno"
      }
    ],
    "port": {
      "address": "/dev/cu.usbmodem14101",
      "label": "/dev/cu.usbmodem14101",
      "protocol": "serial",
      "protocol_label": "Serial Port (USB)",
      "properties": {
        "pid": "0x0043",
        "serialNumber": "75830303934351618212",
        "vid": "0x2341"
      }
    }
  }
]
./arduino-cli board list --watch --format json
{
  "type": "add",
  "address": "/dev/cu.Bluetooth-Incoming-Port",
  "label": "/dev/cu.Bluetooth-Incoming-Port",
  "protocol": "serial",
  "protocol_label": "Serial Port",
  "properties": {}
}
{
  "type": "add",
  "address": "/dev/cu.usbmodem14101",
  "label": "/dev/cu.usbmodem14101",
  "protocol": "serial",
  "protocol_label": "Serial Port (USB)",
  "properties": {
    "pid": "0x0043",
    "serialNumber": "75830303934351618212",
    "vid": "0x2341"
  },
  "boards": [
    {
      "name": "Arduino Uno",
      "fqbn": "arduino:avr:uno"
    }
  ]
}

Expected behavior

Arduino CLI version

source code 0.0.0-git f850706

Operating system

macOS

Operating system version

11.6.5

Additional context

No response

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the nightly build
  • My report contains all necessary details

Metadata

Metadata

Labels

topic: CLIRelated to the command line interfacetopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions