UNPKG

better-ajv-errors

Version:
8 lines (7 loc) 1.59 kB
{ "version": 3, "sources": ["../../../src/validation-errors/additional-prop.js"], "sourcesContent": ["import chalk from 'chalk';\nimport BaseValidationError from './base';\n\nexport default class AdditionalPropValidationError extends BaseValidationError {\n constructor(...args) {\n super(...args);\n this.options.isIdentifierLocation = true;\n }\n\n print() {\n const { message, params } = this.options;\n const output = [chalk`{red {bold ADDTIONAL PROPERTY} ${message}}\\n`];\n\n return output.concat(\n this.getCodeFrame(\n chalk`\uD83D\uDE32 {magentaBright ${params.additionalProperty}} is not expected to be here!`,\n `${this.instancePath}/${params.additionalProperty}`\n )\n );\n }\n\n getError() {\n const { params } = this.options;\n\n return {\n ...this.getLocation(`${this.instancePath}/${params.additionalProperty}`),\n error: `${this.getDecoratedPath()} Property ${\n params.additionalProperty\n } is not expected to be here`,\n path: this.instancePath,\n };\n }\n}\n"], "mappings": ";;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA,kDAA2D,oBAAoB;AAAA,EAC7E,eAAe,MAAM;AACnB,UAAM,GAAG,IAAI;AACb,SAAK,QAAQ,uBAAuB;AAAA,EACtC;AAAA,EAEA,QAAQ;AACN,UAAM,EAAE,SAAS,WAAW,KAAK;AACjC,UAAM,SAAS,CAAC,uCAAuC,YAAY;AAEnE,WAAO,OAAO,OACZ,KAAK,aACH,2BAA2B,OAAO,mDAClC,GAAG,KAAK,gBAAgB,OAAO,oBACjC,CACF;AAAA,EACF;AAAA,EAEA,WAAW;AACT,UAAM,EAAE,WAAW,KAAK;AAExB,WAAO,iCACF,KAAK,YAAY,GAAG,KAAK,gBAAgB,OAAO,oBAAoB,IADlE;AAAA,MAEL,OAAO,GAAG,KAAK,iBAAiB,cAC9B,OAAO;AAAA,MAET,MAAM,KAAK;AAAA,IACb;AAAA,EACF;AACF;", "names": [] }