Skip to content

Commit 9236af7

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

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

docs/site/Parsing-requests.md

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,32 +80,37 @@ async replaceTodo(
8080

8181
#### Object values
8282

83+
{% include note.html content="
84+
LoopBack has switched the definition of json query params from the `exploded`,
85+
`deep-object` style to the `url-encoded` style definition in Open API spec.
86+
" %}
87+
8388
OpenAPI specification describes several ways how to encode object values into a
8489
string, see
8590
[Style Values](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-values)
8691
and
8792
[Style Examples](https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-examples).
8893

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.
94+
At the moment, LoopBack supports both url-encoded and exploded values for json
95+
query parameters. Please note that this style does not preserve the encoding of
96+
primitive types like numbers and booleans. They are always parsed as strings.
9297

93-
For example:
98+
To filter results from the GET `/todo-list` endpoint in the todo-list example
99+
with a relation, { "include": [ { "relation": "todo" } ] }, the following
100+
url-encoded query parameter can be used,
94101

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

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.
106+
As an extension to the url-encoded style, LoopBack also supports queries with
107+
exploded values for json query parameters.
103108

104109
For example:
105110

106111
```
107-
GET /todos?filter={"where":{"completed":false}}
108-
// filter={where: {completed: false}}
112+
GET /todos?filter[where][completed]=false
113+
// filter={where: {completed: 'false'}}
109114
```
110115

111116
### Validation

0 commit comments

Comments
 (0)