Open
Description
Hi,
Here is an extract of a schema that I generated code for:
...
{
"name": "tournaments",
"description": null,
"args": [
{
"name": "query",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "TournamentsQuery",
"ofType": null
}
},
"defaultValue": null
},
{
"name": "page",
"description": null,
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "INPUT_OBJECT",
"name": "PageInfo",
"ofType": null
}
},
"defaultValue": null
}
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Tournaments",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
...
For some reason, the generated code is:
...
class TournamentsFields(GraphQLField):
@classmethod
def edges(cls) -> "TournamentEdgeFields":
return TournamentEdgeFields("edges")
@classmethod
def nodes(cls) -> "TournamentFields":
return TournamentFields("nodes")
@classmethod
def page_info(cls) -> "ResponsePageInfoFields":
return ResponsePageInfoFields("page_info")
total_count: "TournamentsGraphQLField" = TournamentsGraphQLField("totalCount")
def fields(
self,
*subfields: Union[
TournamentsGraphQLField,
"ResponsePageInfoFields",
"TournamentEdgeFields",
"TournamentFields",
]
) -> "TournamentsFields":
"""Subfields should come from the TournamentsFields class"""
self._subfields.extend(subfields)
return self
def alias(self, alias: str) -> "TournamentsFields":
self._alias = alias
return self
...
ResponsePageInfoField("page_info") will result in an error as the api is expecting pageInfo instead of page_info. Any reason why some field names are generated this way ? How to prevent it ?
Metadata
Metadata
Assignees
Labels
No labels