Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Contract to zod #1261

Merged
merged 7 commits into from
Mar 12, 2024
Merged

Migrate Contract to zod #1261

merged 7 commits into from
Mar 12, 2024

Conversation

iamacook
Copy link
Member

@iamacook iamacook commented Mar 6, 2024

Summary

This migrates the validation of Contract to zod.

Changes

  • Removes ContractsValidator and associated schema
  • Adds ContractSchema and infers type from it
  • Propagate required changes in codebase
  • Update associated tests

@iamacook iamacook self-assigned this Mar 6, 2024
.then((c) => new AddressInfo(c.address, c.displayName, c.logoUri));
.then(
(c) =>
new AddressInfo(c.address, c.displayName, c.logoUri ?? undefined),
Copy link
Member Author

Choose a reason for hiding this comment

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

In accordance with the potential null, this needs to fallback to undefined as AddessInfo only accepts string | undefined as a logoUri.

Copy link
Member

Choose a reason for hiding this comment

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

Wdyt about leaving a TODO to change the AddressInfo constructor to accept string | null as a logoUri in a different PR?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. I've added a comment in ea4c64b.

@coveralls
Copy link

coveralls commented Mar 6, 2024

Pull Request Test Coverage Report for Build 8236190961

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 93.37%

Totals Coverage Status
Change from base Build 8236081409: -0.03%
Covered Lines: 6343
Relevant Lines: 6557

💛 - Coveralls

@iamacook iamacook marked this pull request as ready for review March 6, 2024 13:35
@iamacook iamacook requested a review from a team as a code owner March 6, 2024 13:35
@iamacook iamacook marked this pull request as draft March 7, 2024 08:55
@iamacook iamacook marked this pull request as ready for review March 7, 2024 11:42
.then((c) => new AddressInfo(c.address, c.displayName, c.logoUri));
.then(
(c) =>
new AddressInfo(c.address, c.displayName, c.logoUri ?? undefined),
Copy link
Member

Choose a reason for hiding this comment

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

Wdyt about leaving a TODO to change the AddressInfo constructor to accept string | null as a logoUri in a different PR?

@iamacook iamacook merged commit 1e5f2d4 into main Mar 12, 2024
16 checks passed
@iamacook iamacook deleted the zod-contract-validation branch March 12, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants