Skip to content

fix table name in recordId calls #69

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

Merged
merged 3 commits into from
Jan 28, 2025
Merged

Conversation

zvictor
Copy link
Contributor

@zvictor zvictor commented Jan 27, 2025

I have tables in the foo_bar format.
When I try to use the generated types, I get ZodErrors for RecordId like this:

ZodError: [{
  "code": "custom",
  "message": "RecordId must be of type 'fooBar'",
  "path": [
    "id"
  ]
}]
at Object.get error [as error] (file:///node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs:587:31)
at _ZodObject.parse (file:///node_modules/.pnpm/zod@3.23.8/node_modules/zod/lib/index.mjs:692:22)
at getfooBarById (file:///surreal/models/my-project/client/fooBar/getfooBarById.ts:8:55)

I don't see why the RecordId would be created in the camelCase format if the table name is not camel case, unless I am missing something here.
It looks to me like a mistake introduced in #45.

@hammo92
Copy link
Collaborator

hammo92 commented Jan 27, 2025

Seems to make sense, although isn't the table name stored in the name variable not table?

@zvictor
Copy link
Contributor Author

zvictor commented Jan 27, 2025

Absolutely! This is what happens when one pushes a PR at 1am local time hahaha
My thought was to remove table from tableName, and instead I just wrote table there.

Copy link
Contributor Author

@zvictor zvictor left a comment

Choose a reason for hiding this comment

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

fixed

Copy link
Collaborator

@hammo92 hammo92 left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@hammo92 hammo92 merged commit 7f536d3 into sebastianwessel:main Jan 28, 2025
2 checks passed
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