openbmc / phosphor-rest-server

REST server that transposes dbus interfaces to REST
Apache License 2.0
4 stars 11 forks source link

Incorrect types in some JSON responses #21

Closed jk-ozlabs closed 8 years ago

jk-ozlabs commented 8 years ago

This is unlikely to be an issue specific to the REST server implementation, but we do need somewhere to track potential issues with multiple objects exposed over REST. We may want to move this bug, or create dependencies within other packages. Anyway:

We have a few cases of incorrect types being reported over REST. Two examples I've seen:

Inventory items: the fault and present properties are reported as strings, rather than booleans:

    {
      "data": {
         /* ...  */
        "Model Number": [],
        "Name": "OpenPOWER Firmware",
        "Version": "open-power-palmetto-5a4a3d9",
        "fault": "False",
        "fru_type": "SYSTEM",
        "is_fru": 1,
        "present": "False",
        "version": ""
      },
      "message": "200 OK",
      "status": "ok"
    }

(So a serialisation doing a check on data.present will return true here; necessitating a string comparison for some values, but not others)

Boot options: the boot_flags value under settings/host0 is a hex string, rather than a number. Although this can also be "Default", we can represent that as null or 0 instead.

Also, power cap is a number, but represented as a string

 {
  "data": {
    "boot_flags": "Default", 
    "power_cap": "0", 
    "power_policy": "RESTORE_LAST_STATE", 
    "system_state": "HOST_POWERED_ON"
  }, 
  "message": "200 OK", 
  "status": "ok"
}
williamspatrick commented 8 years ago

@bradbishop - Please assess if this is a REST server or skeleton issue. If REST, we should probably move it back to 1.0.

bradbishop commented 8 years ago

This is a skeleton/settings issue.

williamspatrick commented 8 years ago

Issue moved to openbmc/openbmc #554 via ZenHub