Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Carmine DiMascio committed Oct 14, 2019
1 parent d3e185f commit f1a5628
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,22 @@

Provides a simple example demonstrating how [express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) can be used to automatically validate api requests.

## Setup the example project
express-openapi-validator automatically validates each request against an [openapi 3 specification](openapi.yaml). If a request is does not match the spec, the validator automatically returns an appropriate error response.

```shell
# 1. clone this repo
git clone https://github.com/cdimascio/express-openapi-validator-example
## Run it

# 2. install dependencies
npm install
```shell
cd examples
```

## Run it

Start the Api server
Start the server

```shell
npm start
```

## Try it

Try the out the following requests.

The [express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) automatically validates each request against an [openapi 3 specification](openapi.yaml). If a request is does not match the spec, [express-openapi-validator](https://github.com/cdimascio/express-openapi-validator) automatically returns an appropriate error response.

### Validate a query parameter with a value constraint

```shell
Expand Down Expand Up @@ -151,6 +143,8 @@ curl -XPOST http://localhost:3000/v1/pets \

### Response validation (optional)

_Response validation errors return 500s, instead of 400s_

`/v1/pets/99` will return a response that does not match the spec

```
Expand Down

0 comments on commit f1a5628

Please sign in to comment.