Skip to content

generated schema has List's with Nullable members #1058

@saihaj

Description

@saihaj

Which packages are impacted by your issue?

@graphprotocol/graph-cli

Describe the issue

When running the graph init and generating a project to index everything. Graph CLI generates the code which has lists as nullable members and this is something not allowed and errors.

Reproduction

https://github.com/saihaj/graph-tooling-issue-with-lists

Steps to Reproduce the Bug or Issue

checkout out the GH repo.

Expected behavior

We should generate code where GraphQL schema does not have List's with Nullable members.

Screenshots or Videos

asciicast

Platform

  • OS: macOS
  • NodeJS: 17.17.0
  • @graphprotocol/cli version(s): 0.38.0

Subgraph Manifest

specVersion: 0.0.5
schema:
  file: ./schema.graphql
dataSources:
  - kind: ethereum
    name: SoundEditionV1_1
    network: mainnet
    source:
      address: "0x867637A027284a0F26450131fD10c6c681A0B5e0"
      abi: SoundEditionV1_1
      startBlock: 1221
    mapping:
      kind: ethereum/events
      apiVersion: 0.0.7
      language: wasm/assemblyscript
      entities:
        - Airdropped
        - Approval
        - ApprovalForAll
        - BaseURISet
        - ConsecutiveTransfer
        - ContractURISet
        - ERC20Withdrawn
        - ETHWithdrawn
        - EditionCutoffTimeSet
        - EditionMaxMintableRangeSet
        - FundingRecipientSet
        - MetadataFrozen
        - MetadataModuleSet
        - MintRandomnessEnabledSet
        - Minted
        - OperatorFilteringEnablededSet
        - OwnershipHandoverCanceled
        - OwnershipHandoverRequested
        - OwnershipTransferred
        - RolesUpdated
        - RoyaltySet
        - SoundEditionInitialized
        - Transfer
      abis:
        - name: SoundEditionV1_1
          file: ./abis/SoundEditionV1_1.json
      eventHandlers:
        - event: Airdropped(address[],uint256,uint256)
          handler: handleAirdropped
        - event: Approval(indexed address,indexed address,indexed uint256)
          handler: handleApproval
        - event: ApprovalForAll(indexed address,indexed address,bool)
          handler: handleApprovalForAll
        - event: BaseURISet(string)
          handler: handleBaseURISet
        - event: ConsecutiveTransfer(indexed uint256,uint256,indexed address,indexed address)
          handler: handleConsecutiveTransfer
        - event: ContractURISet(string)
          handler: handleContractURISet
        - event: ERC20Withdrawn(address,address[],uint256[],address)
          handler: handleERC20Withdrawn
        - event: ETHWithdrawn(address,uint256,address)
          handler: handleETHWithdrawn
        - event: EditionCutoffTimeSet(uint32)
          handler: handleEditionCutoffTimeSet
        - event: EditionMaxMintableRangeSet(uint32,uint32)
          handler: handleEditionMaxMintableRangeSet
        - event: FundingRecipientSet(address)
          handler: handleFundingRecipientSet
        - event: MetadataFrozen(address,string,string)
          handler: handleMetadataFrozen
        - event: MetadataModuleSet(address)
          handler: handleMetadataModuleSet
        - event: MintRandomnessEnabledSet(bool)
          handler: handleMintRandomnessEnabledSet
        - event: Minted(address,uint256,uint256)
          handler: handleMinted
        - event: OperatorFilteringEnablededSet(bool)
          handler: handleOperatorFilteringEnablededSet
        - event: OwnershipHandoverCanceled(indexed address)
          handler: handleOwnershipHandoverCanceled
        - event: OwnershipHandoverRequested(indexed address)
          handler: handleOwnershipHandoverRequested
        - event: OwnershipTransferred(indexed address,indexed address)
          handler: handleOwnershipTransferred
        - event: RolesUpdated(indexed address,indexed uint256)
          handler: handleRolesUpdated
        - event: RoyaltySet(uint16)
          handler: handleRoyaltySet
        - event: SoundEditionInitialized(indexed address,string,string,address,string,string,address,uint16,uint32,uint32,uint32,uint8)
          handler: handleSoundEditionInitialized
        - event: Transfer(indexed address,indexed address,indexed uint256)
          handler: handleTransfer
      file: ./src/sound-edition-v-1-1.ts

Subgraph GraphQL Schema

type Airdropped @entity(immutable: true) {
  id: Bytes!
  to: [Bytes]! # address[]
  quantity: BigInt! # uint256
  fromTokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type Approval @entity(immutable: true) {
  id: Bytes!
  owner: Bytes! # address
  approved: Bytes! # address
  tokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ApprovalForAll @entity(immutable: true) {
  id: Bytes!
  owner: Bytes! # address
  operator: Bytes! # address
  approved: Boolean! # bool
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type BaseURISet @entity(immutable: true) {
  id: Bytes!
  baseURI: String! # string
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ConsecutiveTransfer @entity(immutable: true) {
  id: Bytes!
  fromTokenId: BigInt! # uint256
  toTokenId: BigInt! # uint256
  from: Bytes! # address
  to: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ContractURISet @entity(immutable: true) {
  id: Bytes!
  contractURI: String! # string
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ERC20Withdrawn @entity(immutable: true) {
  id: Bytes!
  recipient: Bytes! # address
  tokens: [Bytes]! # address[]
  amounts: [BigInt]! # uint256[]
  caller: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type ETHWithdrawn @entity(immutable: true) {
  id: Bytes!
  recipient: Bytes! # address
  amount: BigInt! # uint256
  caller: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type EditionCutoffTimeSet @entity(immutable: true) {
  id: Bytes!
  editionCutoffTime_: BigInt! # uint32
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type EditionMaxMintableRangeSet @entity(immutable: true) {
  id: Bytes!
  editionMaxMintableLower_: BigInt! # uint32
  editionMaxMintableUpper_: BigInt! # uint32
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type FundingRecipientSet @entity(immutable: true) {
  id: Bytes!
  fundingRecipient: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type MetadataFrozen @entity(immutable: true) {
  id: Bytes!
  metadataModule: Bytes! # address
  baseURI: String! # string
  contractURI: String! # string
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type MetadataModuleSet @entity(immutable: true) {
  id: Bytes!
  metadataModule: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type MintRandomnessEnabledSet @entity(immutable: true) {
  id: Bytes!
  mintRandomnessEnabled_: Boolean! # bool
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type Minted @entity(immutable: true) {
  id: Bytes!
  to: Bytes! # address
  quantity: BigInt! # uint256
  fromTokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type OperatorFilteringEnablededSet @entity(immutable: true) {
  id: Bytes!
  operatorFilteringEnabled_: Boolean! # bool
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type OwnershipHandoverCanceled @entity(immutable: true) {
  id: Bytes!
  pendingOwner: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type OwnershipHandoverRequested @entity(immutable: true) {
  id: Bytes!
  pendingOwner: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type OwnershipTransferred @entity(immutable: true) {
  id: Bytes!
  oldOwner: Bytes! # address
  newOwner: Bytes! # address
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type RolesUpdated @entity(immutable: true) {
  id: Bytes!
  user: Bytes! # address
  roles: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type RoyaltySet @entity(immutable: true) {
  id: Bytes!
  bps: Int! # uint16
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type SoundEditionInitialized @entity(immutable: true) {
  id: Bytes!
  edition_: Bytes! # address
  name_: String! # string
  symbol_: String! # string
  metadataModule_: Bytes! # address
  baseURI_: String! # string
  contractURI_: String! # string
  fundingRecipient_: Bytes! # address
  royaltyBPS_: Int! # uint16
  editionMaxMintableLower_: BigInt! # uint32
  editionMaxMintableUpper_: BigInt! # uint32
  editionCutoffTime_: BigInt! # uint32
  flags_: Int! # uint8
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

type Transfer @entity(immutable: true) {
  id: Bytes!
  from: Bytes! # address
  to: Bytes! # address
  tokenId: BigInt! # uint256
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions