Skip to content

Commit

Permalink
add response validation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Sep 15, 2019
1 parent a3129e2 commit a64b1bc
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Install the openapi validator
```javascript
new OpenApiValidator({
apiSpec: './test/resources/openapi.yaml',
validateRequests: true, // (default)
validateResponses: true, // false by default
}).install(app);
```

Expand Down Expand Up @@ -67,6 +69,16 @@ new OpenApiValidator(options).install(app);

**`apiSpec:`** a string value specifying the path to the OpenAPI 3.0.x spec or a JSON object representing an OpenAPI spec.

**`validateRequests:`** enable response validation.

- true - (default) validate requests
- false - do not validate requests

**`validateResponses:`** enable response validation.

- true - validate responses
- false - (default) do not validate responses

**`coerceTypes:`** change data type of data to match type keyword. See the example in Coercing data types and coercion rules. Option values:

- true - (default) coerce scalar data types.
Expand All @@ -75,7 +87,6 @@ new OpenApiValidator(options).install(app);

**`multerOpts:`** the [multer opts](https://github.com/expressjs/multer) to passthrough to multer


## Example Express API Server

Try the complete example below:
Expand Down

0 comments on commit a64b1bc

Please sign in to comment.