• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

strongloop / loopback-next / 15521
76%

Build:
DEFAULT BRANCH: master
Ran 06 Feb 2020 01:19PM UTC
Jobs 1
Files 447
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

pending completion
15521

push

travis-ci-com

deepakrkris
fix: suport complex objects for query params in api explorer

BREAKING CHANGE: This fix has modified the api definitions described by the decorator
'param.query.object', to support Open-API's `url-encoded` definition for json query
parameters.

Previously, such parameters were described with `exploded: true` and
`style: deepObject`, i.e exploded encoding, which turned out to be problematic as explained and discussed in,
https://github.com/swagger-api/swagger-js/issues/1385 and
https://github.com/OAI/OpenAPI-Specification/issues/1706

```json
  {
    "in": "query",
    "style": "deepObject"
    "explode": "true",
    "schema": {}
  }
```

Exploded encoding worked for simple json objects as below but not for complex objects.

```
   http://localhost:3000/todos?filter[limit]=2
```

To address these issues with exploded queries, this fix switches definition of json
query params from the `exploded`, `deep-object` style to the `url-encoded` style
definition in Open-API spec.

LoopBack already supports receiving url-encoded payload for json query parameters.

For instance, to filter api results from the GET '/todo-list' endpoint in the
todo-list example with a specific relation, { "include": [ { "relation": "todo" } ] },
the following url-encoded query parameter can be used,

```
   http://localhost:3000/todos?filter=%7B%22include%22%3A%5B%7B%22relation%22%3A%22todoList%22%7D%5D%7D
```

The above was possible because the coercion behavior in LoopBack performed json
parsing for `deep object` style json query params before this fix. This fix has
modified that behavior by removing json parsing. Since the `exploded` `deep-object`
definition has been removed from the `param.query.object` decorator, this new
behaviour remains just an internal source code aspect as of now.

In effect, this fix only modifies the open api definitions generated from LoopBack
APIs. The 'style' and 'explode' fields are removed and the 'schema' field is moved
under 'content[application/j... (continued)

4248 of 4931 branches covered (86.15%)

Branch coverage included in aggregate %.

17 of 17 new or added lines in 3 files covered. (100.0%)

11053 of 11621 relevant lines covered (95.11%)

921.16 hits per line

Jobs
ID Job ID Ran Files Coverage
2 15521.2 (TASK=test) 06 Feb 2020 01:19PM UTC 0
92.44
Travis Job 15521.2
Source Files on build 15521
Detailed source file information is not available for this build.
  • Back to Repo
  • Build #15521
  • a4ef6403 on github
  • Prev Build on master (#15520)
  • Next Build on master (#15531)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc