Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/cicd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
pnpm run build
pnpm run gen:rickandmorty
pnpm run test:rickandmorty
pnpm run gen:anilist

- name: Compute package version
id: version
Expand Down
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,12 @@
},
"files.eol": "\n",
"files.insertFinalNewline": true,
"cSpell.words": ["codegen", "pnpm", "nvmrc", "rickandmorty", "liquidjs"]
"cSpell.words": [
"anilist",
"codegen",
"liquidjs",
"nvmrc",
"pnpm",
"rickandmorty"
]
}
11 changes: 11 additions & 0 deletions graphql.config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ projects:
plugins:
- packages/graphql-codegen-golang/dist/index.js:
packageName: rickandmorty
anilist:
schema: https://graphql.anilist.co
extensions:
codegen:
generates:
examples/anilist/graphql.go:
hooks:
afterOneFileWrite: go fmt
plugins:
- packages/graphql-codegen-golang/dist/index.js:
packageName: anilist
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"build": "turbo run build",
"format": "prettier --write .",
"gen": "graphql-codegen",
"gen:anilist": "pnpm run gen -p anilist",
"gen:rickandmorty": "pnpm run gen -p rickandmorty",
"lint": "turbo run lint",
"prepare": "husky install",
Expand Down
5 changes: 3 additions & 2 deletions packages/graphql-codegen-golang/src/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ export class GolangGenerator {
prefix: string = '',
nonNull: boolean = false
): string {
if (type.kind === 'NamedType') {
if (type.kind === 'NamedType' && this.types[type.name.value]) {
return [
`${nonNull ? '' : '*'}${prefix}`,
`${this.types[type.name.value]} `,
Expand All @@ -267,7 +267,8 @@ export class GolangGenerator {
nonNull
)
}
throw new Error(`field type "${type}" not supported!`)
console.debug(`Skipped unsupported field type "${type.name.value}"`)
return ''
}

/**
Expand Down