Unwanted Recursion In Generated Classes #26
Replies: 1 comment
-
Hi, Thanks for your feedback. I downloaded your project, found the query you are mentioning here and had a quick look at the code generated which seems to reflect correctly the rippleenergy schema you shared. Using a mapped operation in its simplest way (in your case Taking as example member {
id
registrationCompleted
__typename
} but actually it is composed of many more fields (as per the generated code ) class Member(GQLObject):
id: ID
registrationCompleted: bool
communityName: str
isBusiness: bool
businessName: str
businessRegistrationNumber: str
fullyChargedPreregistered: bool
badges: list_Badge[Badge]
branding: Branding
beneficiaries: list_MemberNextOfKin[MemberNextOfKin]
address: MemberAddress
consumption: MemberConsumption
invoices: list_MemberInvoice[MemberInvoice]
memberships: list_GQLObject[GQLObject] ## Circular Reference for CoopMembership
capacityOwnedTotal: BigInt
ownershipPercentageTotal: float
memberDocument: MemberDocument
investmentTotal: int
billSavingsAcrossAllProjects: int
expectedGenerationAnnualTotal: BigInt
hasReservedInActiveCoop: bool
dateOfReservationInActiveCoop: Date
dateOfLastSharePurchase: Date
hasBoughtSharesInActiveCoop: bool
hasBoughtSharesInGraigFatha: bool
hasBoughtSharesInKirkHill: bool
hasBoughtSharesInMultipleCoops: bool
isSuppliedByOctopusEnergy: bool
currentMemberSupplier: MemberSupplier
waitingListPlaces: list_MemberCoopWaitingListPlace[MemberCoopWaitingListPlace] Consequently the generated call is including mandatory arguments for its inner types. In order to achieve the query you want there are several ways:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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 from generator:
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
Beta Was this translation helpful? Give feedback.
All reactions