Skip to content

Commit

Permalink
fix: allow additional top level fields (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
just-toby authored Aug 2, 2023
1 parent a273873 commit 8e9f553
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/tokenlist.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@
}
},
"type": "object",
"additionalProperties": false,
"properties": {
"name": {
"type": "string",
Expand Down Expand Up @@ -401,4 +400,4 @@
"version",
"tokens"
]
}
}

This comment has been minimized.

Copy link
@antazoey

antazoey Sep 21, 2023

missing new line at EOF?

2 changes: 2 additions & 0 deletions test/__snapshots__/tokenlist.schema.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`schema allows additional top-level fields 1`] = `null`;

exports[`schema allows up to 10k tokens 1`] = `null`;

exports[`schema checks extensions 1`] = `null`;
Expand Down
8 changes: 8 additions & 0 deletions test/tokenlist.schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,12 @@ describe('schema', () => {
};
checkSchema(exampleListWith10kTokensPlusOne, false);
});

it('allows additional top-level fields', () => {
const exampleListWithUnknownField = {
...exampleList,
unknownField: 'foo',
};
checkSchema(exampleListWithUnknownField, true);
});
});

3 comments on commit 8e9f553

@VictoraOj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/tokenlist.schema.json

@VictoraOj
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

src/tokenlist.schema.json

@FelixTheReal00
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please help fix this contract

Please sign in to comment.