Skip to content

Commit

Permalink
Ensuring the Swagger spec is dereferenced before injecting AWS mock c…
Browse files Browse the repository at this point in the history
…onfiguration.

Otherwise, we wouldn't be able to properly modify the object without all references resolved.
  • Loading branch information
khalidx committed Jul 7, 2019
1 parent 682f1a8 commit 8c2079e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ export const specification = async (schemas: string, title: string): Promise<Ope
*/
export const mocks = async (specification: OpenAPIV2.Document): Promise<OpenAPIV2.Document> => {
try {
// validate and dereference the specification
specification = await swagger.validate(specification) as OpenAPIV2.Document
specification['x-amazon-apigateway-request-validators'] = {
validateBodyAndParameters: {
validateRequestBody: true,
Expand Down

0 comments on commit 8c2079e

Please sign in to comment.