run
load_projects_from_configpath
def load_projects_from_configpath(config_path: str,
                                  select: str = None
                                  ) -> Dict[str, GraphQLProject]
Loads the configuration from a configuration file
Arguments:
- config_pathstr - The path to the config file
Returns:
- GraphQLConfig- The configuration
scan_folder_for_configs
def scan_folder_for_configs(folder_path: str = None) -> List[str]
Scans a folder for config files
Arguments:
- folder_pathstr - The path to the folder
Returns:
- List[str]- The list of config files
scan_folder_for_single_config
def scan_folder_for_single_config(folder_path: str = None) -> List[str]
Scans a folder for one single config file
Arguments:
- folder_pathstr - The path to the folder
Returns:
- str- The config file
gen
def gen(filepath: Optional[str] = None,
        project_name: Optional[str] = None,
        strict: bool = False,
        overwrite_path: Optional[str] = None)
Generates Code according to the config file
Arguments:
- filepathstr, optional - The filepath of graphqlconfig. Defaults to "graphql.config.yaml".
- projectstr, optional - The project within that should be generated. Defaults to None.
instantiate
def instantiate(module_path: str, **kwargs)
Instantiate A class from a file.
Needs to conform to path.to.module.ClassName
Arguments:
- module_pathstr - The class path you would like to instatiate
Returns:
- object- The instatiated class.
generate
def generate(project: GraphQLProject) -> str
Genrates the code according to the configugration
The code is generated in the following order:
- Introspect the schema (either url or locally)
- Generate the of grapqhl.ast from this schema
- Instantiate all plugins/parsers/stylers
- Generate the ast from the ast through the plugins and stylers
- Parse the Ast with the parsers
- Generate the code from the ast through ast.unparse
- Process the code string through the processors
Arguments:
- projectGraphQLConfig - The configuraion for the generation
Returns:
- str- The generated code
generate_ast
def generate_ast(config: GeneratorConfig,
                 schema: GraphQLSchema,
                 plugins: Optional[List[Plugin]] = None,
                 stylers: Optional[List[Styler]] = None) -> List[ast.AST]
Generates the ast from the schema
Arguments:
- configGeneratorConfig - The generaion Config (turms section)
- schemaGraphQLSchema - The schema to generate the ast from
- pluginsList[Plugins], optional - The plugins to use. Defaults to [].
- stylersList[Styler], optional - The plugins to use. Defaults to [].
Raises:
- GenerationError- Errors involving the generation of the ast
Returns:
- List[ast.AST]- The generated ast (as list, not as module)