xia_compiler_jsoneditor.compiler.XiaCompilerJsoneditor
- class xia_compiler_jsoneditor.compiler.XiaCompilerJsoneditor
Bases:
object
Generate Json Editor Schema from data model
- __init__()
Methods
__init__
()compile_schema
(resource_mapping, ...[, ...])Compile Open API Document
create_dir_if_not_exists
(directory_name)generate_document_model
(document_class, ...)Generate Open API specs
Attributes
field_dict
id_field
known_messages
python_dict
schema_types
string_dict
- classmethod compile_schema(resource_mapping: dict, document_library: dict, location: str, editor_root: str = '/')
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
editor_root – The root url of editor
Returns:
- classmethod generate_document_model(document_class: Type[Base], document_library: dict, location: str, resource_mapping: dict, editor_root: str)
Generate Open API specs
- Parameters
document_library – Dict[class_name: class_definition]All document definition
document_class – Document class to be parsed
location – reference document location
resource_mapping – full site resource mapping
editor_root – The root url of editor
Notes
schemas is a dictionary which will hold the json schema of the same object of different configuration