Generating arktype definitions from an external source #1404
-
Hello! I am looking at generating arktype definitions from a Solr schema. Right now the best path I could figure out has been to generate a JSON Schema from the Solr schema, and then use @sinclair/typebox-codegen to generate arktype. Is there a better approach I might be missing? |
Beta Was this translation helpful? Give feedback.
Answered by
ssalbdivad
Apr 4, 2025
Replies: 1 comment 6 replies
-
We're publishing |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I don't know if there are projects out there besides
@sinclair/typebox-codegen
that generate ArkType types.Regardless, I would still recommend an approach like I described because...
@ark/json-schema
is guaranteed to be exactly 1-1 by arktype. If you've tested@sinclair/typebox-codegen
and it works well for your needs, I'm very glad, but I can't make any guarantees.If you are already running codegen, you should generate TS types directly from your JSON schema as well and then use those to cast the corresponding Types:
This saves a bunch of unnecessary tsserver overhead valida…