Skip to content

Commit

Permalink
Merge branch 'incrypto32/derived-loader-fixes' of github.com:graphpro…
Browse files Browse the repository at this point in the history
…tocol/graph-tooling into incrypto32/derived-loader-fixes
  • Loading branch information
incrypto32 committed May 30, 2023
2 parents 8ed4459 + dd5d0b2 commit c3a15e4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/@graphprotocol_graph-cli-1340-dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@graphprotocol/graph-cli": patch
---
dependencies updates:
- Updated dependency [`@oclif/core@2.8.4` ↗︎](https://www.npmjs.com/package/@oclif/core/v/2.8.4) (from `2.8.2`, in `dependencies`)
14 changes: 9 additions & 5 deletions packages/cli/src/codegen/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,10 +302,11 @@ export default class SchemaCodeGenerator {
returnType instanceof tsCodegen.NamedType ? returnType.getPrimitiveDefault() : null;

const getNonNullable = `if (!value || value.kind == ValueKind.NULL) {
${primitiveDefault === null
? "throw new Error('Cannot return null for a required field.')"
: `return ${primitiveDefault}`
}
${
primitiveDefault === null
? "throw new Error('Cannot return null for a required field.')"
: `return ${primitiveDefault}`
}
} else {
return ${typesCodegen.valueToAsc('value', fieldValueType)}
}`;
Expand Down Expand Up @@ -351,7 +352,10 @@ export default class SchemaCodeGenerator {
return type;
}

_generatedEntityDerivedFieldGetter(_entityDef: ObjectTypeDefinitionNode, fieldDef: FieldDefinitionNode) {
_generatedEntityDerivedFieldGetter(
_entityDef: ObjectTypeDefinitionNode,
fieldDef: FieldDefinitionNode,
) {
const name = fieldDef.name.value;
const gqlType = fieldDef.type;
const fieldValueType = this._valueTypeFromGraphQl(gqlType);
Expand Down

0 comments on commit c3a15e4

Please sign in to comment.