xia_compiler_openapi.compiler.XiaCompilerOpenapi
- class xia_compiler_openapi.compiler.XiaCompilerOpenapi
Bases:
object
Generate OpenApi Specification from data model
- __init__()
Methods
__init__
()compile_spec
(resource_mapping, ...[, ...])Compile Open API Document
generate_document_model
(document_class, ...)Generate Open API specs
get_action_path
(prefix, resource_name, ...)get_action_path_list
(action_path, ...)get_collection_delete_path
(resource_name, ...)get_collection_get_path
(resource_name, ...)get_collection_path
(prefix, resource_name, ...)get_collection_post_path
(resource_name, ...)get_document_delete_path
(key_fields, ...)get_document_field_path
(key_fields)get_document_get_path
(key_fields, ...)get_document_patch_path
(key_fields, ...)get_document_path
(prefix, resource_name, ...)get_document_post_path
(key_fields, ...)get_document_put_path
(key_fields, ...)get_path_parameter_from_field
(field_name, ...)get_root
(title, version[, resource])Attributes
bundled
field_dict
known_messages
known_parameters
python_dict
string_dict
- classmethod compile_spec(resource_mapping: dict, document_library: dict, location: str, title: str, version: str, url_prefix: str, by_resource: bool = False, simplified: bool = True)
Compile Open API Document
- Parameters
resource_mapping – URL map given by the application
document_library – All models will be saved here
location – file location to where all compiled files will be saved
title – API Title
version – API version
url_prefix – URL prefix of API
by_resource – when True, will generate a specification file per resource name
simplified – Only contain essential endpoint (removing duplicates)
bundled – Will include the schema definition in one file
Returns:
- classmethod generate_document_model(document_class: Type[Base], document_library: dict, action_library: dict)
Generate Open API specs
- Parameters
document_library – Dict[class_name: class_definition]All document definition
action_library – Dict[path: action]All actions
document_class – Document class to be parsed