Skip to content

Commit f0048bc

Browse files
committed
docs: update docs for issue 2208 switching to url-encoded style params
#2208
1 parent 2e66aab commit f0048bc

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

docs/site/Parsing-requests.md

+15-11
Original file line numberDiff line numberDiff line change
@@ -86,28 +86,32 @@ string, see
8686
and
8787
[Style Examples](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-examples).
8888

89-
At the moment, LoopBack supports object values for parameters in query strings
90-
with `style: "deepObject"` only. Please note that this style does not preserve
91-
encoding of primitive types, numbers and booleans are always parsed as strings.
89+
At the moment, LoopBack supports both url-encoded and exploded values for json
90+
query parameters. Please note that this style does not preserve encoding of
91+
primitive types, numbers and booleans are always parsed as strings.
9292

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

9597
```
96-
GET /todos?filter[where][completed]=false
97-
// filter={where: {completed: 'false'}}
98+
http://localhost:3000/todos?filter=%7B%22include%22%3A%5B%7B%22relation%22%3A%22todoList%22%7D%5D%7D
9899
```
99100

100-
As an extension to the deep-object encoding described by OpenAPI, when the
101-
parameter is specified with `style: "deepObject"`, we allow clients to provide
102-
the object value as a JSON-encoded string too.
101+
As an extension to the url-encoded style, LoopBack also supports queries with
102+
exploded values for json query parameters.
103103

104104
For example:
105105

106106
```
107-
GET /todos?filter={"where":{"completed":false}}
108-
// filter={where: {completed: false}}
107+
GET /todos?filter[where][completed]=false
108+
// filter={where: {completed: 'false'}}
109109
```
110110

111+
LoopBack has switched definition of json query params from the `exploded`,
112+
`deep-object` style to the `url-encoded` style definition in Open-API spec,
113+
in a recent release.
114+
111115
### Validation
112116

113117
Validations are applied on the parameters and the request body data. They also

0 commit comments

Comments
 (0)