From 8c2079e599fcb128cb4ffc1325669f4cf44ecfd9 Mon Sep 17 00:00:00 2001 From: Khalid Zoabi Date: Sat, 6 Jul 2019 22:49:12 -0400 Subject: [PATCH] Ensuring the Swagger spec is dereferenced before injecting AWS mock configuration. Otherwise, we wouldn't be able to properly modify the object without all references resolved. --- src/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/index.ts b/src/index.ts index 35acd93..db0bce7 100644 --- a/src/index.ts +++ b/src/index.ts @@ -255,6 +255,8 @@ export const specification = async (schemas: string, title: string): Promise => { try { + // validate and dereference the specification + specification = await swagger.validate(specification) as OpenAPIV2.Document specification['x-amazon-apigateway-request-validators'] = { validateBodyAndParameters: { validateRequestBody: true,