Given a GraphQL entity like this:
type Action @entity(immutable: true) {
id: String!
subgraphId: BigInt!
block: BigInt!
chainId: BigInt!
from: Bytes!
hash: Bytes!
timestamp: BigInt!
category: ActionCategory!
contract: Bytes!
fee: BigInt
addressA: Bytes
addressB: Bytes
amountA: BigInt
amountB: BigInt
}
I would like to auto-generate a fragment like this:
fragment ActionFragment on Action {
id
addressA
addressB
amountA
amountB
block
category
chainId
contract
from
hash
subgraphId
timestamp
}
I know it's not hard to copy-paste the entity and then change it to a fragment, but we have many entities in our schema, and I would prefer an automated solution (if it exists). Maybe there is a tool/npm package that can do this?
ActionCategory, an othertype? (I assumeBigIntandBytesare both scalars)ActionCategoryis an enum. And yes,BigIntandBytesscalars.