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: Handle int64 as BigInt from jsonSchema #526

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PredaaA
Copy link

@PredaaA PredaaA commented Dec 9, 2024

z.bigint() will be interpreted by jsonSchema as { type: 'integer', format: 'int64' }.
Which means that parseFormDataEntry will parseInt during the switch(type). For a value of "337224005901615104", it will return "337224005901615100" instead, and superforms will return a 400 with "Expected bigint, received number".

This check earlier if it's an integer with format int64 and if so return it as a BigInt.

I'm not sure if this should be done earlier though, in jsonSchema file directly during schemaTypes call. Let me know what you think.

Copy link

vercel bot commented Dec 9, 2024

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

Name Status Preview Comments Updated (UTC)
superforms ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 9, 2024 11:49pm

@PredaaA PredaaA changed the title fix: Handle in64 as BigInt from jsonSchema fix: Handle int64 as BigInt from jsonSchema Dec 10, 2024
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.

1 participant