Description
The CommandableSwaggerDocument class allows you to generate Swagger description language that represents the created REST API methods and their parameters.
Constructors
Creates a new instance of the service.
CommandableHttpService(base_route: str, config: ConfigParams, commands: List[ICommand])
- base_route: str - base route of the service
- config: ConfigParams - configuration parameters
- commands: List[ICommand] - list of commands
Fields
Instance methods
_get_spaces
Returns a string with spaces.
_get_spaces(length: int): str
- length: int - determines the length of the string with spaces.
- returns: str - string containing spaces.
to_string
Returns a string with Swagger description language that represents the service methods.
to_string(): str
- returns: str - string with the API information.
_type_to_string
Returns a string with the type name.
_type_to_string(type: Any): str
- type: Any - type (e.g. Integer)
- returns: str - name of the type (e.g. ‘integer’)
_write_array_item
Writes an array item into the Swagger description.
_write_array_item(indent: int, name: str, is_object_item: bool = False)
- indent: int - number of spaces
- name: str - item’s name
- is_object_item: bool - True is the item is an object. False otherwise.
_write_as_object
Adds a property and its value.
_write_as_object(indent: int, name: str, value: Any)
- indent: int - number of spaces
- name: str - name of the property
- value: Any - value of the property
_write_as_string
Adds a string property and its string value.
_write_as_string(indent: int, name: str, value: str)
- indent: int - number of spaces
- name: str - name of the property
- value: str - value of the property
_write_data
Adds data to the Swagger description.
_write_data(indent: int, data: Dict[str, Any])
- indent: int - number of spaces
- name: str - name
- data: Dict[str, Any] - data to be added
_write_name
Writes a property or object name.
_write_name(indent: int, name: str)
- indent: int - number of spaces
- name: str - string with added identation