graphprotocol / graph-client

The Graph library for building GraphQL-based dapps in a decentralized way.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moving from 0.34.0 to 0.47.0, issue with default values

vrde opened this issue Β· comments

commented

πŸ‘‹ I've upgraded from 0.34.0 to 0.47.0. I noticed that the generated schemas are now missing the default values, see example below

0.34.0

export class Resolution extends Entity {
  constructor(id: string) {
    super();
    this.set("id", Value.fromString(id));

    this.set("snapshotId", Value.fromBigInt(BigInt.zero()));
    this.set("ipfsDataURI", Value.fromString(""));
    this.set("isNegative", Value.fromBoolean(false));
    this.set("yesVotesTotal", Value.fromBigInt(BigInt.zero()));
    this.set("resolutionType", Value.fromString(""));
    this.set("createTimestamp", Value.fromBigInt(BigInt.zero()));
    this.set("updateTimestamp", Value.fromBigInt(BigInt.zero()));
    this.set("approveTimestamp", Value.fromBigInt(BigInt.zero()));
    this.set("rejectTimestamp", Value.fromBigInt(BigInt.zero()));
    this.set("createBy", Value.fromBytes(Bytes.empty()));
    this.set("voters", Value.fromStringArray(new Array(0)));
    this.set("hasQuorum", Value.fromBoolean(false));
    this.set("executionTo", Value.fromBytesArray(new Array(0)));
    this.set("executionData", Value.fromBytesArray(new Array(0)));
  }

  // ...

Source: https://github.com/NeokingdomDAO/subgraph/blob/89a6068b0437ef75ed2b1242e5d94f0300747074/dao/generated/schema.ts#L182-L201

0.47.0

export class Resolution extends Entity {
  constructor(id: string) {
    super();
    this.set("id", Value.fromString(id));
  }

  // ...

Source: https://github.com/NeokingdomDAO/subgraph/blob/23970e8ace0d061317026a128fa7bfc25c3ed9c2/dao/generated/schema.ts#L216-L220

Question

Is there any flag I need to pass to the generator to create the missing default values?

Is this related to Graph Client or Graph CLI?

commented

Is this related to Graph Client or Graph CLI?

I got confused, it should be the CLI. Is this the right repo https://github.com/graphprotocol/graph-tooling ?

Yes you can create your issue there.