py_gql.utilities.ast_transforms#

Common utilities used to transform GraphQL documents.

class py_gql.utilities.ast_transforms.RemoveFieldAliasesVisitor[source]#

Bases: py_gql.lang.visitor.DispatchingVisitor

Visitor implementation which removes aliases from output fields.

class py_gql.utilities.ast_transforms.CamelCaseToSnakeCaseVisitor[source]#

Bases: py_gql.lang.visitor.DispatchingVisitor

Visitor implementation which renames field from camelCase to snake_case.

This is useful when working between languages with different conventions such as Python and Javascript.

Note

This only work on the incoming document and usually needs to be paired with a post-processing step on the client or before sending out the response.

class py_gql.utilities.ast_transforms.SnakeCaseToCamelCaseVisitor[source]#

Bases: py_gql.lang.visitor.DispatchingVisitor

Visitor implementation which renames field from snake_case to camelCase.

This is useful when working between languages with different conventions such as Python and Javascript.

Note

This only work on the incoming document and usually needs to be paired with a post-processing step on the client or before sending out the response.