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

Add support for TypedSQL queries. #398

Open
2 tasks done
gausie opened this issue Oct 14, 2024 · 9 comments · May be fixed by #427
Open
2 tasks done

Add support for TypedSQL queries. #398

gausie opened this issue Oct 14, 2024 · 9 comments · May be fixed by #427
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@gausie
Copy link

gausie commented Oct 14, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Versions

Prisma 5.20.0
prisma-json-types-generator 3.1.1

Description

A query written with Prisma's new TypedSQL returns JsonValue as normal for a column that has been typed with this package.

Steps to Reproduce

Write a TypedSQL query that returns a Json field. Observe that it is typed as JsonValue

Expected Behavior

It should be typed according to the triple slash comment in schema.prisma

@arthurfiorette
Copy link
Owner

Hi @gausie, thanks for opening this feature request, would you like to work on it? remember to add unit tests...

@arthurfiorette arthurfiorette added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Oct 14, 2024
@arthurfiorette arthurfiorette changed the title Does not support TypedSQL Add support for TypedSQL queries. Oct 14, 2024
@arthurfiorette
Copy link
Owner

I'm not even sure how is the plugin system working for TypedSQL...

@gausie
Copy link
Author

gausie commented Oct 14, 2024 via email

@gausie
Copy link
Author

gausie commented Oct 15, 2024

Had a little look into doing it - generating types with --sql relies on introspection via the schema engine, so it doesn't fit well into the current approach to testing. We could look at using something like pgmock to provide a valid url for the db provider... but that's a big change. What do you think?

@arthurfiorette
Copy link
Owner

I think it will be easier to just spin up a docker postgres via docker compose and test using that db/schema.

@gausie
Copy link
Author

gausie commented Oct 15, 2024

How would you want to do that in CI?

@gausie
Copy link
Author

gausie commented Oct 15, 2024

Fair enough!

@arthurfiorette arthurfiorette linked a pull request Dec 17, 2024 that will close this issue
@arthurfiorette
Copy link
Owner

I did some research at #427 and turns out nothing related to typedSql queries ends up inside dmmf...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants