diff --git a/src/lib/validateTokenList.ts b/src/lib/validateTokenList.ts index e7838473..6938c042 100644 --- a/src/lib/validateTokenList.ts +++ b/src/lib/validateTokenList.ts @@ -7,15 +7,24 @@ import { ArbTokenList } from './types'; export const tokenListIsValid = (tokenList: ArbTokenList | TokenList) => { const ajv = new Ajv(); addFormats(ajv); - delete schema.properties.tokens; - const validate = ajv.compile(schema); + const { tokens, ...properties } = schema.properties; + const schemaWithoutTokensProperty = { + ...schema, + properties, + }; + const validate = ajv.compile(schemaWithoutTokensProperty); const res = validate(tokenList); if (validate.errors) { - const output = betterAjvErrors(schema, tokenList, validate.errors, { - indent: 2, - }); + const output = betterAjvErrors( + schemaWithoutTokensProperty, + tokenList, + validate.errors, + { + indent: 2, + }, + ); console.log(output); }