Skip to content

Commit b586503

Browse files
authored
Merge pull request #91 from helios-ag/update-qs-validation
Updated faq with information about qs validator
2 parents b2ad6e9 + d586de4 commit b586503

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

docs/faq.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,21 @@ export interface MyModel {
4242
## How can I get the most from my OAS?
4343

4444
Now that you have a OpenAPI Specification (OAS) (swagger.json), you can use all kinds of amazing tools that generate documentation, client SDKs, and more [here](http://openapi.tools).
45+
46+
## How to override limit for validating large arrays (with more than 20 elements)
47+
48+
By default [Express](https://github.com/expressjs/express) uses [qs](https://github.com/ljharb/qs) as parser internally, and its have default limitation for validating 20 elements in array
49+
to override this you must add following configuration to your express config:
50+
51+
```ts
52+
const app = express();
53+
54+
app.set('query parser', function(str) {
55+
return qs.parse(str, { arrayLimit: Infinity });
56+
});
57+
58+
app.use(bodyParser.json())
59+
app.use(Router())
60+
```
61+
62+
Please note that you must place it on top of other middleware.

0 commit comments

Comments
 (0)