sgqlc
sgqlc copied to clipboard
Issues with operation generator
Hi, I am using the generator to create an operations.py file from multiple input files and deep import path. My generate command is:
sgqlc-codegen operation --schema schema.json src.services.apc.graphql.schema operations.py graphql/orders.gql graphql/hierarchy.gql
The generated operations.py file has two issues: The schema import path is:
_schema = src.services.apc.graphql.schema
_schema_root = _schema.src.services.apc.graphql.schema
but should be
_schema = src.services.apc.graphql.schema
_schema_root = _schema.schema
And the other issue is the generated operations.py file contains multiple definitions of Operations, Mutation and Query class, one for each file, but only one of each with all queries/mutations should exist.
The full generated file (except execution methods):
import sgqlc.types
import sgqlc.operation
import src.services.apc.graphql.schema
_schema = src.services.apc.graphql.schema
_schema_root = _schema.src.services.apc.graphql.schema
__all__ = ('Operations',)
...
class Mutation:
create_forecast_orders = mutation_create_forecast_orders()
delete_forecast_orders = mutation_delete_forecast_orders()
...
class Query:
get_forecasts_in_horizon = query_get_forecasts_in_horizon()
get_locations_by_name = query_get_locations_by_name()
get_products_by_name = query_get_products_by_name()
class Operations:
mutation = Mutation
query = Query
...
class Mutation:
get_location_product_location_hierarchy = mutation_get_location_product_location_hierarchy()
get_location_product_product_hierarchy = mutation_get_location_product_product_hierarchy()
class Operations:
mutation = Mutation