graph-tooling
graph-tooling copied to clipboard
Codegen does not differentiate between `Int` and `Int!` in schema.graphql
A type with a field Int
is generated the same as with field Int!
, i.e.
type Event @entity {
id: ID!
timestamp: Int
}
and
type Event @entity {
id: ID!
timestamp: Int!
}
both generate the following getter and setter:
get timestamp(): i32 {
let value = this.get("timestamp");
return value!.toI32();
}
set timestamp(value: i32) {
this.set("timestamp", Value.fromI32(value));
}
I have the same issue, any progress on this?
@KedziaPawel are you encountering a specific issue / unexpected behaviour? @saihaj @incrypto32 might have more context but from memory there is an issue with Assemblyscript returning the same for null
and 0
My problem is that in the schema.graphql
I've declared the variable as eModeCategoryId: Int
, so I would expect that I can assign null
to it. But in the code, I can assign only a number to it. I've added some screenshots.
My @graphprotocol/graph-ts
library version is 0.31.0
OK got it - and you want to assign null
to it to "unset" the field in certain cases?
Any update @azf20?
Seems to still be an issue. We've extended an entity as part of a graft. The attribute is a nullable int - Int
, yet similarly generated getter is non-nullable.
yes I did some research and did some improvements https://github.com/graphprotocol/graph-tooling/pull/1284 we will end up returning a default value which would be 0
which won't essentially translate to null