Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Dec 24, 2023
1 parent d2a1c1d commit 8293265
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions src/lib/validateTokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 8293265

Please sign in to comment.