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 drizzle-effect package - an integration with @effect/schema #2665

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

arekmaz
Copy link

@arekmaz arekmaz commented Jul 20, 2024

This is a proposal to add a package similar to drizzle-zod and heavily based on it, with analogical features, integrated with the effect ecosystem, @effect/schema documentation.

This is a new version of this pull request

One big difference is I would like this to have MIT license if possible.

Feature requests:
#2187
Effect-TS/effect#3208

todo:

  • insert schemas
  • insert refine
  • select schemas
  • select refine
  • schema is an instance of Schema.Struct
  • package cleanup

todos in case of interest in merging:

Similarly to `effect-zod` this package lets users automatically
create schemas provided by the [effect](https://effect.website)
ecosystem.
Co-authored-by: Amos Bastian <amosbastian@gmail.com>
@arekmaz arekmaz force-pushed the effect-schema branch 2 times, most recently from 9713087 to c214e92 Compare July 24, 2024 17:30
@arekmaz
Copy link
Author

arekmaz commented Aug 13, 2024

@AndriiSherman would you guys be interested in merging this PR?

@danielo515
Copy link

Would love to have this too

@niklasravnsborg
Copy link

Great work, looking forward to it @arekmaz!

I think it would be awesome to get some kind of response from the Drizzle team, to get some clarity on whether this is a welcomed package in this repo or if it should live somewhere else...

@ssijak
Copy link

ssijak commented Sep 11, 2024

@amosbastian will this be merged?

@amosbastian
Copy link

@amosbastian will this be merged?

I don't have anything to do with drizzle, I'm just the guy who created the feature request (and am using it, works great) 😊

@ElasticBottle
Copy link

@AndriiSherman would love to get your thoughts here!

@tcarrio
Copy link

tcarrio commented Oct 27, 2024

@amosbastian will this be merged?

I don't have anything to do with drizzle, I'm just the guy who created the feature request (and am using it, works great) 😊

Hey @amosbastian, exciting to hear you're using this successfully, is there somewhere others could install and use this until it's merged in?

@amosbastian
Copy link

@amosbastian will this be merged?

I don't have anything to do with drizzle, I'm just the guy who created the feature request (and am using it, works great) 😊

Hey @amosbastian, exciting to hear you're using this successfully, is there somewhere others could install and use this until it's merged in?

Just copy the index.ts file and use it? Not sure if I understand the problem 😅

@tcarrio
Copy link

tcarrio commented Nov 1, 2024

@amosbastian I just wasn't sure if it was packaged and published to a registry. If that's how you're using it then that'll probably be how I test it out 👍

@amosbastian
Copy link

@amosbastian I just wasn't sure if it was packaged and published to a registry. If that's how you're using it then that'll probably be how I test it out 👍

O yeah, it's not a package anywhere afaik. Btw, instead of importing from @effect/schema you can now import directly from effect since they merged it into there

@TGTGamer
Copy link

@arekmaz looks like this code doesn't support the Schema.optionalWith(Schema.Date, { nullable: true }), might need to make this work as it's needed for the JsonSchema specification and openAPI usage of Schema.

See thread https://discordapp.com/channels/795981131316985866/1310313189233131541

@arekmaz
Copy link
Author

arekmaz commented Nov 25, 2024

@TGTGamer this code is a bit old as I'm waiting for any kind of response from the drizzle team, but seing as some people are using it, I'll do my best to update it soon to the newest schema version (that is merged into effect)

@TGTGamer
Copy link

TGTGamer commented Nov 25, 2024

@TGTGamer this code is a bit old as I'm waiting for any kind of response from the drizzle team, but seing as some people are using it, I'll do my best to update it soon to the newest schema version (that is merged into effect)

Thanks pal, let me know if there's anywhere I can assist you in this code, I'm using it in a company project so happy to dedicate some company time to helping you out :)

@arekmaz
Copy link
Author

arekmaz commented Nov 27, 2024

@TGTGamer Right now I’m kinda stuck with finding a way how to verify the correctness of the created schemas in tests. The old approach - comparing serialized ast’s is crashing when given optionalWith(Json), and also I learnt that the serialization behavior is not really supported.
If you have any ideas how to solve it let me know.

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.

8 participants