@@ -86,28 +86,32 @@ string, see
86
86
and
87
87
[ Style Examples] ( https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#style-examples ) .
88
88
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.
92
92
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,
94
96
95
97
```
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
98
99
```
99
100
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.
103
103
104
104
For example:
105
105
106
106
```
107
- GET /todos?filter={" where":{" completed": false}}
108
- // filter={where: {completed: false}}
107
+ GET /todos?filter[ where][ completed]= false
108
+ // filter={where: {completed: ' false' }}
109
109
```
110
110
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
+
111
115
### Validation
112
116
113
117
Validations are applied on the parameters and the request body data. They also
0 commit comments