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

fix: change zod schemas inputs/outputs to readonly to match abitype #194

Merged

Conversation

matbour
Copy link

@matbour matbour commented Oct 6, 2023

Description

This PR upgrades zod to v3.22+ to get access to ZodReadonly.
This allow to update the zod schemas from abitype/zod so type from abitype.

Added readonly to the following types:

  • AbiContructor.inputs
  • AbiError.inputs
  • AbiEvent.inputs
  • AbiFunction.inputs / AbiFunction.outputs

Additional Information

  • I read the contributing guide
  • I added documentation related to the changes made.
  • I added or updated tests related to the changes made.

Your ENS/address: windyy.eth


PR-Codex overview

Detailed summary

  • Changed the following types to readonly in zod package: AbiContructor.inputs, AbiError.inputs, AbiEvent.inputs, AbiFunction.inputs / AbiFunction.outputs
  • Updated the zod package version to 3.22.4 in pnpm-lock.yaml
  • Updated the zod package version to ^3 >=3.22.0 in package.json
  • Added a note in CONTRIBUTING.md to use pnpm@8.3.1 and typescript@5.0.4 for installing or upgrading packages
  • Added a note in CONTRIBUTING.md to build the package before running the test:typecheck suite
  • Updated the zod.ts file to make the components, inputs, and outputs properties readonly in various types
  • Updated the zod.test-d.ts file to import additional types and test their assignability and extension

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@changeset-bot
Copy link

changeset-bot bot commented Oct 6, 2023

🦋 Changeset detected

Latest commit: ec50e18

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Oct 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
abitype ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 9, 2023 4:09pm

@commit-lint
Copy link

commit-lint bot commented Oct 6, 2023

Bug Fixes

  • change zod AbiEvent.inputs to readonly to match AbiType.inputs (477c914)

Features

  • extends readonly to all AbiParameter (a399099)

Documentation

  • document that abitype must be built before testing types (583e964)
  • explicitly specify pnpm and TypeScript versions in CONTRIBUTING.md (238b89e)
  • fix TypeScript typo (a3a5776)
  • revert explicit pnpm and TS versions, add suggested note (ec50e18)

Chore

  • dependencies: rollback tpo pnpm v8.3.1 and typescript v5.0.4 (24dd673)

Contributors

mathieu-bour

Commit-Lint commands

You can trigger Commit-Lint actions by commenting on this PR:

  • @Commit-Lint merge patch will merge dependabot PR on "patch" versions (X.X.Y - Y change)
  • @Commit-Lint merge minor will merge dependabot PR on "minor" versions (X.Y.Y - Y change)
  • @Commit-Lint merge major will merge dependabot PR on "major" versions (Y.Y.Y - Y change)
  • @Commit-Lint merge disable will desactivate merge dependabot PR
  • @Commit-Lint review will approve dependabot PR
  • @Commit-Lint stop review will stop approve dependabot PR

@matbour matbour marked this pull request as ready for review October 6, 2023 17:23
@matbour matbour changed the title fix: change zod AbiEvent.inputs to readonly to match AbiType.inputs fix: change zod AbiEvent.inputs to readonly to match abitype AbiEvent.inputs Oct 6, 2023
@matbour matbour changed the title fix: change zod AbiEvent.inputs to readonly to match abitype AbiEvent.inputs fix: change zod AbiEvent.inputs to readonly to match AbiEvent type Oct 6, 2023
@matbour matbour changed the title fix: change zod AbiEvent.inputs to readonly to match AbiEvent type fix: change zod AbiEvent.inputs to readonly to match AbiEvent type Oct 6, 2023
@Raiden1411
Copy link
Collaborator

In order to run the pnpm test:typecheck you need to run pnpm build first. You can take a look at how the CI runs on tests to get a better idea of it.
I think it would also make sense in adding the readonly property to AbiParameter on where ever it gets called. Would you mind adding it?

@matbour matbour changed the title fix: change zod AbiEvent.inputs to readonly to match AbiEvent type fix: change zod schemas inputs/outputs to readonly to match abitype Oct 9, 2023
@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

All modified lines are covered by tests ✅

Comparison is base (529da5c) 99.90% compared to head (ec50e18) 99.90%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #194   +/-   ##
=======================================
  Coverage   99.90%   99.90%           
=======================================
  Files          21       21           
  Lines        2055     2055           
  Branches      325      325           
=======================================
  Hits         2053     2053           
  Misses          2        2           
Files Coverage Δ
src/zod.ts 100.00% <100.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@matbour
Copy link
Author

matbour commented Oct 9, 2023

@Raiden1411 Thanks a lot for clarifications, I was able to test the types as expected. I added a line in .github/CONTRIBUTING.md about this specific case.

Moreover, I added all relevant .readonly() to inputs and outputs.

Copy link
Collaborator

@Raiden1411 Raiden1411 left a comment

Choose a reason for hiding this comment

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

Needs final suggested changes

package.json Show resolved Hide resolved
.github/CONTRIBUTING.md Outdated Show resolved Hide resolved
pnpm-lock.yaml Outdated Show resolved Hide resolved
.github/CONTRIBUTING.md Outdated Show resolved Hide resolved
@Raiden1411 Raiden1411 merged commit 380c9d9 into wevm:main Oct 9, 2023
16 checks passed
@github-actions github-actions bot mentioned this pull request Oct 9, 2023
@matbour matbour deleted the changed-abi-event-inputs-to-read-only branch October 9, 2023 18:13
@matbour matbour restored the changed-abi-event-inputs-to-read-only branch October 9, 2023 18:13
@matbour matbour deleted the changed-abi-event-inputs-to-read-only branch October 11, 2023 20:42
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.

2 participants