SchemaMap (autotransform.util.request)
Provides utility methods for interacting with the Schema map.
- class autotransform.util.schema_map.SchemaMap
Bases:
objectA map that can convert Schema names in to AutoTransformSchemas.
- _data
The data that backs the Schema map.
- Type:
Dict[str, Tuple[SchemaType, str]]
- add_schema(schema_name: str, schema_type: SchemaType, target: str) None
Adds the specified Schema to the map.
- Parameters:
schema_name (str) – The name of the Schema to add.
schema_type (SchemaType) – The type of the Schema.
target (str) – The target for the Schema.
- static get() SchemaMap
Gets the singleton instance of the SchemaMap.
- Returns:
The singleton instance of the SchemaMap.
- Return type:
- get_schema(schema_name: str) AutoTransformSchema
Get an AutoTransformSchema from the map.
- Parameters:
schema_name (str) – The name of the schema to get.
- Returns:
The AutoTransformSchema with the supplied name.
- Return type:
- static get_schema_directory() str
Gets the directory where schemas and the schema map are located.
- Returns:
The directory where schemas and the schema map are located.
- Return type:
str
- static get_schema_map_path() str
Gets the path to the schema map.
- Returns:
The path to the schema map.
- Return type:
str
- static get_schema_path(file_name: str) str
Gets the path to a given schema
- Parameters:
file_name (str) – The name of the file for a schema.
- Returns:
The path where a schema is located.
- Return type:
str
- items() Sequence[Tuple[str, Tuple[SchemaType, str]]]
Gets the items in the SchemaMap.
- Returns:
The items from the SchemaMap.
- Return type:
Tuple[str, Tuple[SchemaType, str]]
- remove_schema(schema_name: str) None
Removes the specified Schema from the map.
- Parameters:
schema_name (str) – The name of the Schema to remove.
- write() None
Writes the SchemaMap to a file as JSON.