Skip to content

Commit

Permalink
docs: update decorator documentation for url-encoded query params
Browse files Browse the repository at this point in the history
issue: #2208
  • Loading branch information
deepakrkris committed Feb 12, 2020
1 parent 2e66aab commit 7402ffc
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions docs/site/decorators/Decorators_openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,33 @@ You can find specific use cases in
_The parameter location cookie is not supported yet, see_
_(https://github.com/strongloop/loopback-next/issues/997)_

### Parameter decorator for objects

One of the parameter decorator types, `@param.query.object` is applied to
generate an OpenAPI definition for query parameters with JSON values.

The generated definition supports the `url-encoded` style specified in Open API.
This style supports receiving url-encoded payload for json query parameters.

To filter 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
```

As an extension to the url-encoded style, LoopBack also supports queries with
exploded values for json query parameters.

```
GET /todos?filter[where][completed]=false
// filter={where: {completed: 'false'}}
```

LoopBack has switched the definition of json query params from the `exploded`,
`deep-object` style to the `url-encoded` style definition in Open API spec.

### RequestBody Decorator

Syntax: see
Expand Down

0 comments on commit 7402ffc

Please sign in to comment.