Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

Commit

Permalink
Correctly build GraphQLSchema object in generated SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
timkendall committed Nov 25, 2021
1 parent ae2934f commit 6813a65
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions CURRENT_LIMITATIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- [x] Rewrite `Result` and `Variable` types
- [x] Type-level testing
- [x] Default unknown scalars to `string`'s
- [ ] Fix nested variable extraction
- [ ] Dynamic selector building (using Proxy's)
- [ ] Restricing `Selection`'s in selector function returns
- [ ] Finish rewriting unit tests
- [ ] Field alias support
Expand Down
2 changes: 1 addition & 1 deletion codegen/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@timkendall/tql-gen",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "Code generator for @timkendall/tql.",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
14 changes: 9 additions & 5 deletions codegen/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import prettier from "prettier";
import { typeTransform, selectorInterfaceTransform } from "./transforms";

export const render = (sdl: string): string => {
const ast = parse(sdl);
const ast = parse(sdl, { noLocation: true });
const schema = buildSchema(sdl);

const transforms = [
Expand Down Expand Up @@ -35,7 +35,10 @@ export const render = (sdl: string): string => {
`;

const source =
`import {
`
import { buildASTSchema } from 'graphql'
import {
TypeConditionError,
NamedType,
Field,
Expand All @@ -50,12 +53,13 @@ export const render = (sdl: string): string => {
inlineFragment,
argument,
selectionSet
} from './src'
} from '@timkendall/tql'
export { Result, Variables, $ } from '@timkendall/tql'
export { Result, Variables, $ } from './src'
` +
`
export const SCHEMA = ${JSON.stringify(ast)}
export const SCHEMA = buildASTSchema(${JSON.stringify(ast)})
export const ENUMS = ${ENUMS}
` +
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@timkendall/tql",
"author": "Timothy Kendall",
"license": "MIT",
"version": "1.0.0-rc.1",
"version": "1.0.0-rc.2",
"description": "Write GraphQL queries in TypeScript.",
"sideEffects": false,
"keywords": [
Expand Down

0 comments on commit 6813a65

Please sign in to comment.