{"action":"closed","issue":{"url":"https://api.github.com/repos/strongloop/loopback/issues/2043","repository_url":"https://api.github.com/repos/strongloop/loopback","labels_url":"https://api.github.com/repos/strongloop/loopback/issues/2043/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback/issues/2043/comments","events_url":"https://api.github.com/repos/strongloop/loopback/issues/2043/events","html_url":"https://github.com/strongloop/loopback/issues/2043","id":131530341,"number":2043,"title":"export-api-def: /PersistedModels/count output doesn't look correct?","user":{"login":"hideya","id":321713,"avatar_url":"https://avatars.githubusercontent.com/u/321713?v=3","gravatar_id":"","url":"https://api.github.com/users/hideya","html_url":"https://github.com/hideya","followers_url":"https://api.github.com/users/hideya/followers","following_url":"https://api.github.com/users/hideya/following{/other_user}","gists_url":"https://api.github.com/users/hideya/gists{/gist_id}","starred_url":"https://api.github.com/users/hideya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hideya/subscriptions","organizations_url":"https://api.github.com/users/hideya/orgs","repos_url":"https://api.github.com/users/hideya/repos","events_url":"https://api.github.com/users/hideya/events{/privacy}","received_events_url":"https://api.github.com/users/hideya/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-05T01:46:45Z","updated_at":"2016-02-05T10:38:20Z","closed_at":"2016-02-05T10:38:20Z","body":"Although https://github.com/strongloop/loopback/blob/master/lib/persisted-model.js#L677-L683 says:\r\n```js\r\n    setRemoting(PersistedModel, 'count', {\r\n      description: 'Count instances of the model matched by where from the data source.',\r\n      accessType: 'READ',\r\n      accepts: {arg: 'where', type: 'object', description: 'Criteria to match model instances'},\r\n      returns: {arg: 'count', type: 'number'},\r\n      http: {verb: 'get', path: '/count'}\r\n    });\r\n```\r\n`slc loopback:export-api-def` output for the `count` method of PersistedModels becomes like the following:\r\n```yaml\r\n  /Users/count:\r\n    get:\r\n      tags:\r\n        - User\r\n      summary: Count instances of the model matched by where from the data source.\r\n      description: !<tag:yaml.org,2002:js/undefined> ''\r\n      operationId: User.count\r\n      parameters:\r\n        - name: where\r\n          in: query\r\n          description: Criteria to match model instances\r\n          required: false\r\n          type: string\r\n          format: JSON\r\n      responses:\r\n        '200':\r\n          description: Request was successful\r\n          schema:\r\n            type: object\r\n      deprecated: false\r\n```\r\nThis output causes following two issues when to use with [swagger codegen](https://github.com/swagger-api/swagger-codegen):\r\n\r\n 1. Type for parameter `where` becomes `string`, with which I don't see a way to specify a filter like `/api/users?filter[where][property]=[value]` as the string parameter is processed to generate a URL in this way: `/api/users?filter=escaped-param-string`.\r\n\r\n 2. Response type becomes `object` instead of `number`, which prevents [swagger codegen](https://github.com/swagger-api/swagger-codegen) to generate a client-side method to receive the counted number as the response.\r\n\r\nAre these conversions working as expected?"}}