-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
13aea2e
commit 345b618
Showing
17 changed files
with
3,848 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { writeFileSync } from "fs"; | ||
import { compileFromFile } from "json-schema-to-typescript"; | ||
|
||
const schemas = [ | ||
"CapabilitiesResponse", | ||
"SchemaResponse", | ||
"QueryRequest", | ||
"QueryResponse", | ||
"ErrorResponse", | ||
"ExplainResponse", | ||
"MutationRequest", | ||
"MutationResponse", | ||
]; | ||
|
||
async function generate() { | ||
console.log("Generating types..."); | ||
for (const schema of schemas) { | ||
writeFileSync( | ||
`./schemas/${schema}.d.ts`, | ||
await compileFromFile(`../api_schemas/generated/${schema}.schema.json`) | ||
); | ||
} | ||
console.log("done!"); | ||
} | ||
|
||
generate(); | ||
|
||
// notes to self: dynamic type generation seems to not be working corectly due to generated type size | ||
// generating the types as a build step seems to work, except for query response. This could be an issue with the query response schema |
Oops, something went wrong.