Skip to content

Commit

Permalink
Generate derived field getter
Browse files Browse the repository at this point in the history
  • Loading branch information
incrypto32 committed May 5, 2023
1 parent 95a7f9a commit 987eca2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/cli/src/codegen/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
/* eslint-disable unicorn/no-array-for-each */
import debug from 'debug';
import Schema from '../schema';
import * as typesCodegen from './types';
import * as tsCodegen from './typescript';
Expand Down Expand Up @@ -280,6 +281,13 @@ export default class SchemaCodeGenerator {
}

_generateEntityFieldGetter(_entityDef: ObjectTypeDefinitionNode, fieldDef: FieldDefinitionNode) {
const isDerivedField = this._isDerivedField(fieldDef);
const codegenDebug = debug('codegen');
if (isDerivedField) {
codegenDebug(`Generating derived field getter for ${fieldDef.name.value}`);
return this._generateDerivedFieldGetter(_entityDef, fieldDef);
}

const name = fieldDef.name.value;
const gqlType = fieldDef.type;
const fieldValueType = this._valueTypeFromGraphQl(gqlType);
Expand Down
1 change: 0 additions & 1 deletion packages/cli/tests/cli/init/ethereum/from-contract
Submodule from-contract deleted from cabf43

0 comments on commit 987eca2

Please sign in to comment.