Closed xddq closed 1 year ago
@xddq Hi, have enabled discussions :)
Do you use some kind of chat where I could just throw some questions about the project at you? Matrix, Slack, Irc, anything? It would be helpful to clarify goals and next steps.
I'm currently on discord's TS channel under the handle sinclair#7766, I'm not usually all that active there, but you can ping me a message and I should be able to respond relatively promptly (depending on what time of day it is)
So, I've done a little bit more work on this today, mostly just trying to produce cohesive type model that's going to be supportive of transforming out to other formats. I'm keeping https://sinclairzx81.github.io/typebox-workbench/ in sync with the changes in this repo, so to test what's currently working and what isn't, the easiest way will be to test through the workbench.
The project currently consists of the following.
TypeScriptToTypeBox
and evaluates the TypeBoxModel
(at runtime)TypeBoxModel
and generates output schematicsCurrently I've setup the ModelToJsonSchema
and ModelToZod
transforms. I'm using the zod codegen to ensure there's enough information encoded in the TypeBoxModel
to generate something as sophisticated as zod (which would be the upper bound of sophisticated transforms). There's still a bit of work to do, but things should be relatively stable as of current.
At this stage, just have a browse through the codebase and ping me any questions you have. I think for ts2typebox
, you're mostly going to be interested in the TypeScripToTypeBox
module (so feel free to submit PR's to update, or just make commits as necessary (just don't break anything :D)), ill be working mostly downstream from the Model > X
transforms. So long as TypeScripToTypeBox
is generating correct TB types, things should line up downstream.
Cheers! S
Alright! A little, as simple as possible, writeup about the broad project goals would also be helpful for me!
I think my next steps will be getting the indexed access types merged and then start to add tests for the typescript-to-typebox stuff.
In general I can imagine myself helping out with the GraphQL -> Model(and probably Model-> GraphQL) stuff, if you want any help there. I played with the idea of implementing an own graphql server from scratch for a while and the idea of implementing runtype validation based on the model generated based on the GraphQL schema would be cool.
Hey!
Thanks for the invitation. Interesting idea of a "model" which can be used to generate any IDL.