apache / openwhisk

Apache OpenWhisk is an open source serverless cloud platform
https://openwhisk.apache.org/
Apache License 2.0
6.54k stars 1.17k forks source link

REST API response for list package and get package has different definition for "binding", they should keep consistent otherwise we can't use the same model class for both API calls. #2405

Open andrewnet opened 7 years ago

andrewnet commented 7 years ago

REST API response for list package and get package has different definition for "binding", they should keep consistent otherwise we can't use the same model class for both API calls.

Environment details:

Bluemix OpenWhisk

Steps to reproduce the issue:

  1. Create a package
  2. Run wsk -v package list, this should give you a list of packages defined in the system
  3. Run wsk -v package get <any package name> to get details of a specific package
  4. Compare the result, you should see the attribute binding is a boolean in package list and it is an object in package detail

Provide the expected results and outputs:

The type of attribute binding needs to be consistent in both API call

Provide the actual results and outputs:

sample for package list

[{
  "name": "package_messagehub_myenv",
  "binding": true,
  "publish": false,
  "annotations": [{
    "key": "binding",
    "value": {
      "namespace": "whisk.system",
      "name": "messaging"
    }
  }],
  "version": "0.0.1",
  "namespace": "Entity_discovery_dev"
}, {
  "name": "MyPackage",
  "binding": true,
  "publish": false,
  "annotations": [{
    "key": "binding",
    "value": {
      "namespace": "whisk.system",
      "name": "messaging"
    }
  }],
  "version": "0.0.1",
  "namespace": "Entity_discovery_dev"
}]

Sample for package detail

{
    "namespace": "Entity_discovery_dev",
    "name": "MyPackage",
    "version": "0.0.1",
    "publish": false,
    "binding": {
        "namespace": "whisk.system",
        "name": "messaging"
    },
    ...
}
rabbah commented 7 years ago

The binding property on the "list" view is computed in couchdb, and could be updated there.