Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Nov 30, 2019
1 parent 9884190 commit 0e20fda
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions README.md
Expand Up @@ -29,7 +29,7 @@ npm i express-openapi-validator

## Usage

馃express-openapi-validator supports promises, async/await, and callbacks. See the [example](#example-express-api-server) below:
馃express-openapi-validator supports [promises](#promise), [async/await](#asyncawait), and [callbacks](#callback). It can also be used [synchronously](#synchronous)

#### Async/Await

Expand Down Expand Up @@ -57,7 +57,6 @@ app.use((err, req, res, next) => {

_**Note:** Ensure express is configured with all relevant body parsers. Body parser middleware functions must be specified prior to any validated routes. See an [example](#example-express-api-server)_.


## Usage (options)

See [Advanced Usage](#Advanced-Usage) options to:
Expand Down Expand Up @@ -310,7 +309,6 @@ Errors in response validation return `500`, not of `400`

In addition to async/await, express-openapi-validator may be used with promises, callbacks, or synchronously.


#### Promise

```javascript
Expand Down Expand Up @@ -357,18 +355,16 @@ new OpenApiValidator({

_Note syncrhonous mode requires the `deasync` module._

**Q:** What does it mean to use the validator 'synchronously'?
**Q:** What does it mean to use the validator 'synchronously'?

**A:** The validator's initial parse and `$ref` resolution of the OpenAPI 3 spec executed synchronously. Effectively, this means that the `install` method is blocking.


**Install**

```shell
npm i express-openapi-validator deasync
```


1. Install the openapi validator

```javascript
Expand All @@ -391,7 +387,6 @@ app.use((err, req, res, next) => {
});
```


## Advanced Usage

### OpenApiValidator Options
Expand Down Expand Up @@ -643,7 +638,6 @@ that are _not_ under the base URL鈥攕uch as pages鈥攚ill not be validated.

_**Note** that in some cases, it may be necessary to skip validation for paths under the base url. To do this, use the `ignorePaths` option._


## FAQ

**Q:** Can I use a top level await?
Expand Down

0 comments on commit 0e20fda

Please sign in to comment.