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 838ba21
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions docs/site/decorators/Decorators_openapi.md
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,47 @@ 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

{% include note.html content="
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.
" %}

The parameter decorator `@param.query.object` is applied to generate an Open API
definition for query parameters with JSON values.

The generated definition supports the `url-encoded` style specified in Open API.

```json
{
"in": "query"
"content": {
"application/json": {
"schema": {}
}
}
}
```

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'}}
```

### RequestBody Decorator

Syntax: see
Expand Down

0 comments on commit 838ba21

Please sign in to comment.