From 7ebc86807d1ce5c149f1f507923c2b54b152cd6f Mon Sep 17 00:00:00 2001 From: Matheus Robert Lichtnow Date: Fri, 31 Jan 2020 09:50:34 -0300 Subject: [PATCH] fix(validate): fixed validate function error for swagger 2.0 files --- src/validation/validate.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/validation/validate.ts b/src/validation/validate.ts index 19ddcfc..fe3157c 100644 --- a/src/validation/validate.ts +++ b/src/validation/validate.ts @@ -27,7 +27,10 @@ export const validate = async (api: string, rules?: Rules) => { const parsedApi: any = await parse(api); if (parsedApi.swagger) { - return Promise.reject(Error('This is not using OpenAPI 3.0.0^')); + const error = new Error(); + error.name = 'NonValidApiVersion'; + error.message = 'This is not using OpenAPI 3.0.0^'; + return Promise.reject(error); } const parsedRules: Rules = {