Hilzu / express-openapi-validate

Express middleware to validate requests based on an OpenAPI 3 document
Apache License 2.0
75 stars 12 forks source link

The 0.6.0 update breaks support for the example keyword #72

Closed rscarson closed 3 years ago

rscarson commented 3 years ago

The openapi spec still supports the example keyword (https://swagger.io/docs/specification/adding-examples/)

But my tests fail with Uncaught Error: strict mode: unknown keyword: "example" after the latest update

Here is a relevant section of my spec:


/** 
 * @openapi
 *
 * components:
 *   schemas:
 *     Device:
 *        type: object
 *        properties:
 *          guid:
 *            type: string
 *            format: uuid
 *            pattern: ^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-\b[0-9a-fA-F]{12}$
 *            example: 00000000-0000-0000-0000-000000000000
 *          clientId:
 *            type: integer
 *            example: 1
 *          description:
 *            type: string
 *            example: Kingston 8gb
 *          deployment_date:
 *            type: string
 *            format: date-time
 *          facility:
 *            type: string
 *            example: HQ
 *          room:
 *            type: string
 *            example: Lobby
 *          location:
 *            type: string
 *            example: Countertop
 *          time
```zone:
 *            type: string
 *            example: America/Toronto
 *          enabled:
 *            type: boolean
 *          active:
 *            type: boolean
 *          offnetwork:
 *            type: boolean
 *        example:
 *          guid: 00000000-0000-0000-0000-000000000000
 *          clientId: 1
 *          description: Kingston 8gb
 *          facility: HQ
 *          room: Lobby
 *          location: Countertop
 *          enabled: true
 *          active: false
 *          offnetwork: false
 *     DeviceResponse:
 *       allOf:
 *       - $ref: '#/components/schemas/Device'
 *       - type: object
 *         required:
 *         - createdAt
 *         - updatedAt
 *         properties:
 *           createdAt:
 *             type: string
 *             format: date-time
 *           updatedAt:
 *             type: string
 *             format: date-time
*/