generate_config_file.py

View code on Github

Configure cli to run based on a YAML configuration file.

ts_backend_check.cli.generate_config_file.path_exists(path: str) bool[source]

Check if path entered by the user exists withing the filesystem.

Parameters:
pathstr

Path should be entered as a string from the user.

Returns:
bool

Return true or false based on if path exists.

ts_backend_check.cli.generate_config_file.prompt_yes_no(prompt: str) bool[source]

Prompt the user and receive a yes or no input.

Parameters:
promptstr

Prompt question to receive str input.

Returns:
bool

Return the boolean value.

ts_backend_check.cli.generate_config_file.config_file_validation(config: dict) bool[source]

Validate the configuration file for ts-backend-check to ensure it has the necessary keys, values and types.

Parameters:
configdict

The configuration file to validate.

Returns:
bool

True if the configuration file is valid. False otherwise.

ts_backend_check.cli.generate_config_file.config_file_is_valid() bool[source]

Check that the configuration file for ts-backend-check is not empty and has the necessary keys.

Returns:
bool

True if the ts-backend-check configuration file is valid. False otherwise.

ts_backend_check.cli.generate_config_file.write_config(config: dict[str, dict[str, object]]) None[source]

Function to write into .ts-backend-check.yaml file.

Parameters:
configdict[str, dict[str, object]]

Passing a dictionary as key str with another dict as value.

ts_backend_check.cli.generate_config_file.get_file_path_from_user(description: str | None, input_prompt: str, no_key_description: str) str | None[source]

Function to prompt the user about file Path.

Parameters:
descriptionstr | None

Description to prompt the user.

input_promptstr

Specified prompt for receiving input paths.

no_key_descriptionstr

Prompt the user when file path is not found.

Returns:
str | None

Return the path when its found otherwise None.

ts_backend_check.cli.generate_config_file.collect_and_validated_backend_model_path() str[source]

Prompt the user for the file path.

Returns:
str

Return the path once it’s found.

ts_backend_check.cli.generate_config_file.collect_and_validate_frontend_interface_paths() list[str][source]

Collect the frontend paths and validate their existence.

Returns:
list[str]

Return frontend paths in list[str].

ts_backend_check.cli.generate_config_file.collect_backend_models_to_ignore() list[str][source]

Collect the names of backend models that should be ignored.

Returns:
list[str]

A list of Models needs to be ignored.

ts_backend_check.cli.generate_config_file.collect_model_name_conversions() dict[str, list[str]][source]

Collect model names that should be converted.

Returns:
dict[str,list[str]]

A dictionary of converted models after input Prompts.

ts_backend_check.cli.generate_config_file.derive_entry(backend_model_path: str, ts_interface_paths: list[str], check_blank_model_fields: bool, backend_models_to_ignore: list | None) dict[str, Any][source]

Derive a configuration file entry dictionary from component parts.

Parameters:
backend_model_pathstr

The backend model path for the configuration entry.

ts_interface_pathslist[str]

The list of frontend interface file paths for the configuration entry.

check_blank_model_fieldsbool

The boolean value for whether blank model fields should be checked.

backend_models_to_ignorelist | None

The list of backend models to ignore.

Returns:
dict[str,Any]

A dictionary consisting of Various paths and values.

ts_backend_check.cli.generate_config_file.configure_model_interface_entries() None[source]

Prompt the user for arguments that should be used to create the configuration file entries.

ts_backend_check.cli.generate_config_file.generate_config_file() None[source]

Main function to create or update configuration.