fake-api-server.ci.surveillance.model.config.api_config¶
This module provides data models and utilities for managing API documentation
configuration settings for section fake-api-server
, handling subcommand-line
arguments, and deserializing data into structured configurations used in a fake
API server.
BaseArgsAdapter()
dataclass
¶
BaseArgsAdapter serves as an abstract base class for adapting arguments in a consistent manner with a specific subcommand model.
This class is designed to enforce the implementation of the to_subcmd_model
method in all derived classes, ensuring that they convert arguments to a
ParserArguments
instance. It is intended to be subclassed and used in
contexts where argument transformation and adherence to a particular
subcommand model are required.
ATTRIBUTE | DESCRIPTION |
---|---|
__abstractmethods__ |
Defines abstract methods that must be implemented by any subclass deriving from BaseArgsAdapter.
|
FakeAPIConfigSetting(server_type=str(), subcmd=dict())
dataclass
¶
Bases: _BaseModel
Represents the configuration settings for a fake API.
This class provides the structure and logic for handling and deserializing configuration settings related to a fake API system. It includes attributes for specifying the type of server and subcommands with their respective configuration details. The class supports deserialization from a given mapping to produce a fully-initialized configuration setting object.
ATTRIBUTE | DESCRIPTION |
---|---|
server_type |
Specifies the type of the server.
TYPE:
|
subcmd |
Maps the subcommand enums to their corresponding configuration details.
TYPE:
|
PullApiDocConfigArgs(config_path='./api.yaml', include_template_config=False, base_file_path='./', base_url='', dry_run=False, divide_api=False, divide_http=False, divide_http_request=False, divide_http_response=False)
dataclass
¶
Bases: _BaseModel
, BaseArgsAdapter
Configuration arguments for pulling API documentation.
This dataclass is designed to encapsulate the configuration details required to pull API documentation. It includes settings for config paths, base URLs, division of API elements, and other related parameters. This class also provides methods to deserialize data into an instance of the class and to convert it into a subcommand-compatible model format.
ATTRIBUTE | DESCRIPTION |
---|---|
config_path |
The file path to the API configuration YAML file.
TYPE:
|
include_template_config |
Boolean flag indicating whether to include the template configuration in the process.
TYPE:
|
base_file_path |
The path to the base directory for generated files.
TYPE:
|
base_url |
The base URL for the API.
TYPE:
|
dry_run |
Boolean flag indicating whether the operation should be a simulation without actual execution.
TYPE:
|
divide_api |
Boolean flag indicating whether to divide the API components during the process.
TYPE:
|
divide_http |
Boolean flag indicating whether to divide HTTP components in the API process.
TYPE:
|
divide_http_request |
Boolean flag indicating whether to divide the HTTP request parts of the API.
TYPE:
|
divide_http_response |
Boolean flag indicating whether to divide the HTTP response parts of the API.
TYPE:
|
to_subcmd_model()
¶
Transforms and maps the internal configuration objects and attributes into
a SubcmdPullArguments
model. This method provides the necessary arguments
and configuration for constructing a pull command subparser model and
ensures appropriate data is passed for command execution.
RETURNS | DESCRIPTION |
---|---|
SubcmdPullArguments
|
A |
Source code in fake_api_server_plugin/ci/surveillance/model/config/api_config.py
SubCmdConfig(args)
dataclass
¶
Bases: _BaseModel
Represents the configuration for a sub-command in the application.
The SubCmdConfig class is used for handling sub-command configuration and its conversion to a specific model. It provides functionality to deserialize raw data into a SubCmdConfig instance and to transform the arguments into a sub-command argument model format.
ATTRIBUTE | DESCRIPTION |
---|---|
args |
List of command-line arguments.
TYPE:
|
to_subcmd_args(subcmd_arg_model)
¶
Converts a list of command-line arguments into a model instance by mapping argument keys and values into the appropriate format. This method parses arguments, verifies their validity, and applies them to create and populate an instance of the given model class.
PARAMETER | DESCRIPTION |
---|---|
subcmd_arg_model
|
The model class (
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
`BaseArgsAdapter`
|
An instance of the provided |