Skip to content

Unwanted Recursion In Generated Classes #24

@danieledwardgeorgehitchcock

Description

I am using this tool to create a Python Module see here. This is using the open GraphQL API instance here.

I seem to be having issues regarding the recursion of fields in comparison to what I am expecting to see from the documented queries in the GraphQL client referenced above.

An example of this is as follows:

Expected query:

query Me {
  me {
    id
    firstName
    lastName
    email
    phoneNumber
    isSuperuser
    isStaff
    isGuest
    isActive
    isEmailVerified
    dateJoined
    groups {
      id
      name
      permissions {
        id
        codename
        name
        __typename
      }
      __typename
    }
    referred {
      id
      user {
        id
        firstName
        lastName
        dateJoined
        member {
          id
          __typename
        }
        __typename
      }
      recommendedBy {
        id
        __typename
      }
      __typename
    }
    payments {
      id
      paid
      amount
      __typename
    }
    directDebit {
      id
      accountName
      accountSortCode
      accountNumber
      paymentDay
      __typename
    }
    member {
      id
      registrationCompleted
      __typename
    }
    __typename
  }
}

Query from generator:

query Me {
  me {
    id
    firstName
    lastName
    groups {
      id
      name
      permissions {
        id
        name
        codename
      }
    }
    isStaff
    isActive
    isGuest
    dateJoined
    isEmailVerified
    createdAt
    updatedAt
    email
    phoneNumber
    member {
      id
      registrationCompleted
      communityName
      isBusiness
      businessName
      businessRegistrationNumber
      fullyChargedPreregistered
      badges {
        id
        name
        code
        description
        imageUrl
      }
      branding {
        id
        createdAt
        updatedAt
        cssClassName
        displayName
        heroImage {
          id
          name
          description
          url
        }
        howItWorksImage {
          id
          name
          description
          url
        }
        howDoesItWorkPanelImageFirst {
          id
          name
          description
          url
        }
        howDoesItWorkPanelImageSecond {
          id
          name
          description
          url
        }
        howDoesItWorkPanelImageThird {
          id
          name
          description
          url
        }
        supplier {
          id
          name
          isRipplePartner
          highlights
          logoUrl
        }
        signUpState {
          id
          createdAt
          updatedAt
          address {
            id
            town
            country
            line1
            line2
            county
            postcode
            mpan
            mprn
            manuallyEntered
            requiresManualSwitch
            hasPrepaidMeter
            selectedFromDropdown {
              line1
              line2
              line3
              town
              county
              postcode
              mpans
              mprn
              gsp
              economy7
              prepaidElectricityMeter
              display
            }
          }
          consumption {
            id
            approvalStatus
            evidenceSubmissions {
              id
              createdAt
              status
              approvedEvidence
              reviewEvidence
              memberNote
              evidences {
                id
                createdAt
                consumption
                name
                file
                fileSizeFormatted
                fileUrl
                contentType
              }
              adminNote
              approvedDate
              approvedBy {
                id
                firstName
                lastName
                email
                phoneNumber
              }
            }
            latestSubmission {
              id
              createdAt
              status
              approvedEvidence
              reviewEvidence
              memberNote
              evidences {
                id
                createdAt
                consumption
                name
                file
                fileSizeFormatted
                fileUrl
                contentType
              }
              adminNote
              approvedDate
              approvedBy {
                id
                firstName
                lastName
                email
                phoneNumber
              }
            }
            expectedGenerationKwh
            totalApprovedConsumptionKwh
            totalUnapprovedConsumptionKwh
          }
          quote {
            id
            currency {
              id
              code
              precision
              symbol
            }
            coop {
              id
              currency {
                id
                code
                precision
                symbol
              }
              name
              code
              description
              generationfarm {
                id
                currency {
                  id
                  code
                  precision
                  symbol
                }
                name
                address {
                  id
                  town
                  country
                }
                longitude
                latitude
                isLocationConfirmed
                model
                capacity
                generationType
                operationalStatus
                startDate
                generationData {
                  title
                  dataSet {
                    netPowerOutputKwh
                    dateTime
                    isForecastData
                    savingsForPeriod
                  }
                }
                lightShowImage
                capacityToGenerationFactor
                insightsChartData {
                  chartData {
                    windSpeedMph
                    generationKwh
                    savings
                    fromTime
                    toTime
                  }
                  cumulativeData {
                    cumulativeSavings
                    cumulativeGenerationKwh
                    averageWindSpeedMph
                  }
                  input {
                    genFarmId
                    period
                    startDate
                    endDate
                  }
                  userErrors {
                    field
                    message
                  }
                }
                latestGenerationDataPoint {
                  id
                  timestamp
                  windSpeedAvg
                  generatorSpeedAvg
                  bladeAngleAvg
                  nacellePositionNorth
                }
              }
              status
              wattageSku
              active
              firstYearEstimatedBillSavingsPerWattHour
              estimatedBillSavingsPerWattHour
              maxCapacityPerMember
              minCapacityPerMember
              publicCloseDate
              percentageFunded
              timelineProgression
              isAvailableForLocalPurchase
              documents {
                id
                document {
                  id
                  updatedAt
                  name
                  category
                  subcategory
                  description
                  documentTags {
                    id
                    name
                  }
                }
                version
                documentUrl
              }
              maxGenerationPerMember
              minGenerationPerMember
              costTotalPerWattHour
              localPurchasePostcodes
            }
            capacity
            ownershipMultiplier
            capacityCost
            arrangementFee
            vouchers {
              id
              code
              expiry
              displayName
              payload {
                code
              }
              error
              valid
              allocated
            }
            costTotal
            costTotalLocale
            electricityConsumptionAnnual
            expectedGenerationAnnual
            paymentTotal
            paymentTotalLocale
            instalments
            instalmentAmount1
            instalmentAmount1Locale
            instalmentAmountN
            instalmentAmountNLocale
            vouchersAmount
            vouchersAmountLocale
            billSavingsAnnualEstimate
            co2SavingsAnnualEstimate
            plantedTreesSavingsAnnualEstimate
            shareCount
            arrangementFeeLocale
            arrangementFeeTax
            arrangementFeeTaxLocale
            arrangementFee1
            arrangementFeeLocale1
            arrangementFeeTax1
            arrangementFeeTaxLocale1
          }
          supplierQuotes {
            id
            supplier {
              id
              name
              isRipplePartner
              highlights
              logoUrl
            }
            isAlreadyWithPartnerSupplier
            isAlreadyWithBrandedSupplier
            wantsToSeeTariffs
            switchesToAnotherPartnerSupplier
            electricitySupplierId
            postcode
            hasEconomy7Meter
            electricityAnnualDayKwh
            electricityAnnualNightKwh
            gasAnnualKwh
            supplierQuotesJson
            selectedQuoteCode
            switchesGas
            requiresManualSwitch
            isSwitchDelayed
            switchFailed
            switchDisabled
            delayedSwitchDate
            initiated
            acknowledgesTariffsWillBeDifferentInTheFuture
            acknowledgesHeWillLoseSavingsIfHeDoesntSwitchOnTime
            acknowledgesHeNeedsToContactTheSupplierToUpdateAddress
            selectedTariff
            currency {
              id
              code
              precision
              symbol
            }
            electricityAnnualStandardKwh
          }
        }
      }
      beneficiaries {
        id
        nominatedPerson
        email
        phone
        line1
        line2
        town
        postcode
      }
      address {
        id
        town
        country
        line1
        line2
        county
        postcode
        mpan
        mprn
        manuallyEntered
        requiresManualSwitch
        hasPrepaidMeter
        selectedFromDropdown {
          line1
          line2
          line3
          town
          county
          postcode
          mpans
          mprn
          gsp
          economy7
          prepaidElectricityMeter
          display
        }
      }
      consumption {
        id
        fromCalculator
        peopleCount
        bedroomsCount
        hasElectricVehicle
        hasElectricHeating
        hasHeatPump
        hasSolarPanels
        solarPanelsCapacity
        acknowledgesToProvideBillEvidence
        electricityAnnualKwh
      }
      invoices {
        id
        quote {
          id
          currency {
            id
            code
            precision
            symbol
          }
          coop {
            id
            currency {
              id
              code
              precision
              symbol
            }
            name
            code
            description
            generationfarm {
              id
              currency {
                id
                code
                precision
                symbol
              }
              name
              address {
                id
                town
                country
              }
              longitude
              latitude
              isLocationConfirmed
              model
              capacity
              generationType
              operationalStatus
              startDate
              generationData {
                title
                dataSet {
                  netPowerOutputKwh
                  dateTime
                  isForecastData
                  savingsForPeriod
                }
              }
              lightShowImage
              capacityToGenerationFactor
              insightsChartData {
                chartData {
                  windSpeedMph
                  generationKwh
                  savings
                  fromTime
                  toTime
                }
                cumulativeData {
                  cumulativeSavings
                  cumulativeGenerationKwh
                  averageWindSpeedMph
                }
                input {
                  genFarmId
                  period
                  startDate
                  endDate
                }
                userErrors {
                  field
                  message
                }
              }
              latestGenerationDataPoint {
                id
                timestamp
                windSpeedAvg
                generatorSpeedAvg
                bladeAngleAvg
                nacellePositionNorth
              }
            }
            status
            wattageSku
            active
            firstYearEstimatedBillSavingsPerWattHour
            estimatedBillSavingsPerWattHour
            maxCapacityPerMember
            minCapacityPerMember
            publicCloseDate
            percentageFunded
            timelineProgression
            isAvailableForLocalPurchase
            documents {
              id
              document {
                id
                updatedAt
                name
                category
                subcategory
                description
                documentTags {
                  id
                  name
                }
              }
              version
              documentUrl
            }
            maxGenerationPerMember
            minGenerationPerMember
            costTotalPerWattHour
            localPurchasePostcodes
          }
          capacity
          ownershipMultiplier
          capacityCost
          arrangementFee
          vouchers {
            id
            code
            expiry
            displayName
            payload {
              code
            }
            error
            valid
            allocated
          }
          costTotal
          costTotalLocale
          electricityConsumptionAnnual
          expectedGenerationAnnual
          paymentTotal
          paymentTotalLocale
          instalments
          instalmentAmount1
          instalmentAmount1Locale
          instalmentAmountN
          instalmentAmountNLocale
          vouchersAmount
          vouchersAmountLocale
          billSavingsAnnualEstimate
          co2SavingsAnnualEstimate
          plantedTreesSavingsAnnualEstimate
          shareCount
          arrangementFeeLocale
          arrangementFeeTax
          arrangementFeeTaxLocale
          arrangementFee1
          arrangementFeeLocale1
          arrangementFeeTax1
          arrangementFeeTaxLocale1
        }
        category
        invoiceUrl
        description
        gross
        net
      }
      capacityOwnedTotal
      ownershipPercentageTotal
      memberDocument {
        id
        createdAt
        category
        comments
        file
        documentUrl
      }
      investmentTotal
      billSavingsAcrossAllProjects
      expectedGenerationAnnualTotal
      hasReservedInActiveCoop
      dateOfReservationInActiveCoop
      dateOfLastSharePurchase
      hasBoughtSharesInActiveCoop
      hasBoughtSharesInGraigFatha
      hasBoughtSharesInKirkHill
      hasBoughtSharesInMultipleCoops
      isSuppliedByOctopusEnergy
      currentMemberSupplier {
        id
        supplier {
          id
          name
          isRipplePartner
          highlights
          logoUrl
        }
        accountIdentifier
        personalApiKey
        octopusMpan
        octopusMeterSerialNumber
        isOctopusApiConnectionVerified
        wantsToSeeOctopusApiConsumptionData
      }
      waitingListPlaces {
        id
        waitingList {
          id
          coop {
            id
            currency {
              id
              code
              precision
              symbol
            }
            name
            code
            description
            generationfarm {
              id
              currency {
                id
                code
                precision
                symbol
              }
              name
              address {
                id
                town
                country
              }
              longitude
              latitude
              isLocationConfirmed
              model
              capacity
              generationType
              operationalStatus
              startDate
              generationData {
                title
                dataSet {
                  netPowerOutputKwh
                  dateTime
                  isForecastData
                  savingsForPeriod
                }
              }
              lightShowImage
              capacityToGenerationFactor
              insightsChartData {
                chartData {
                  windSpeedMph
                  generationKwh
                  savings
                  fromTime
                  toTime
                }
                cumulativeData {
                  cumulativeSavings
                  cumulativeGenerationKwh
                  averageWindSpeedMph
                }
                input {
                  genFarmId
                  period
                  startDate
                  endDate
                }
                userErrors {
                  field
                  message
                }
              }
              latestGenerationDataPoint {
                id
                timestamp
                windSpeedAvg
                generatorSpeedAvg
                bladeAngleAvg
                nacellePositionNorth
              }
            }
            status
            wattageSku
            active
            firstYearEstimatedBillSavingsPerWattHour
            estimatedBillSavingsPerWattHour
            maxCapacityPerMember
            minCapacityPerMember
            publicCloseDate
            percentageFunded
            timelineProgression
            isAvailableForLocalPurchase
            documents {
              id
              document {
                id
                updatedAt
                name
                category
                subcategory
                description
                documentTags {
                  id
                  name
                }
              }
              version
              documentUrl
            }
            maxGenerationPerMember
            minGenerationPerMember
            costTotalPerWattHour
            localPurchasePostcodes
          }
        }
        generationRequestedKwh
      }
    }
    payments {
      id
      updatedAt
      currency {
        id
        code
        precision
        symbol
      }
      amount
      description
      category
      failed
      paid
      refunded
      dueAt
      amountLocale
      memberInvoices {
        id
        quote {
          id
          currency {
            id
            code
            precision
            symbol
          }
          coop {
            id
            currency {
              id
              code
              precision
              symbol
            }
            name
            code
            description
            generationfarm {
              id
              currency {
                id
                code
                precision
                symbol
              }
              name
              address {
                id
                town
                country
              }
              longitude
              latitude
              isLocationConfirmed
              model
              capacity
              generationType
              operationalStatus
              startDate
              generationData {
                title
                dataSet {
                  netPowerOutputKwh
                  dateTime
                  isForecastData
                  savingsForPeriod
                }
              }
              lightShowImage
              capacityToGenerationFactor
              insightsChartData {
                chartData {
                  windSpeedMph
                  generationKwh
                  savings
                  fromTime
                  toTime
                }
                cumulativeData {
                  cumulativeSavings
                  cumulativeGenerationKwh
                  averageWindSpeedMph
                }
                input {
                  genFarmId
                  period
                  startDate
                  endDate
                }
                userErrors {
                  field
                  message
                }
              }
              latestGenerationDataPoint {
                id
                timestamp
                windSpeedAvg
                generatorSpeedAvg
                bladeAngleAvg
                nacellePositionNorth
              }
            }
            status
            wattageSku
            active
            firstYearEstimatedBillSavingsPerWattHour
            estimatedBillSavingsPerWattHour
            maxCapacityPerMember
            minCapacityPerMember
            publicCloseDate
            percentageFunded
            timelineProgression
            isAvailableForLocalPurchase
            documents {
              id
              document {
                id
                updatedAt
                name
                category
                subcategory
                description
                documentTags {
                  id
                  name
                }
              }
              version
              documentUrl
            }
            maxGenerationPerMember
            minGenerationPerMember
            costTotalPerWattHour
            localPurchasePostcodes
          }
          capacity
          ownershipMultiplier
          capacityCost
          arrangementFee
          vouchers {
            id
            code
            expiry
            displayName
            payload {
              code
            }
            error
            valid
            allocated
          }
          costTotal
          costTotalLocale
          electricityConsumptionAnnual
          expectedGenerationAnnual
          paymentTotal
          paymentTotalLocale
          instalments
          instalmentAmount1
          instalmentAmount1Locale
          instalmentAmountN
          instalmentAmountNLocale
          vouchersAmount
          vouchersAmountLocale
          billSavingsAnnualEstimate
          co2SavingsAnnualEstimate
          plantedTreesSavingsAnnualEstimate
          shareCount
          arrangementFeeLocale
          arrangementFeeTax
          arrangementFeeTaxLocale
          arrangementFee1
          arrangementFeeLocale1
          arrangementFeeTax1
          arrangementFeeTaxLocale1
        }
        category
        invoiceUrl
        description
        gross
        net
      }
      invoices {
        id
        createdAt
        description
        net
        gross
        refunded
        category
        invoiceUrl
        invoiceType
      }
      paymentType
      status
      project
      date
    }
    directDebit {
      id
      createdAt
      updatedAt
      accountName
      accountSortCode
      accountNumber
      paymentDay
    }
    referred {
      id
    }
    isSuperuser
    apiKey
    consumptionApproval {
      id
      approvalStatus
      evidenceSubmissions {
        id
        createdAt
        status
        approvedEvidence
        reviewEvidence
        memberNote
        evidences {
          id
          createdAt
          consumption
          name
          file
          fileSizeFormatted
          fileUrl
          contentType
        }
        adminNote
        approvedDate
        approvedBy {
          id
          firstName
          lastName
          email
          phoneNumber
        }
      }
      latestSubmission {
        id
        createdAt
        status
        approvedEvidence
        reviewEvidence
        memberNote
        evidences {
          id
          createdAt
          consumption
          name
          file
          fileSizeFormatted
          fileUrl
          contentType
        }
        adminNote
        approvedDate
        approvedBy {
          id
          firstName
          lastName
          email
          phoneNumber
        }
      }
      expectedGenerationKwh
      totalApprovedConsumptionKwh
      totalUnapprovedConsumptionKwh
    }
  }
}

I have tried following through the examples in the repo to try and resolve this but cannot seem to work out if it is a bug or a misunderstanding..?

At present, the generated call throws multiple errors due to missing required values from the response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions