doc_writer

API Doc templates generator.

class hydra_python_core.doc_writer.Context(address: str, class_: Optional[hydra_python_core.doc_writer.HydraClass] = None, collection: Optional[hydra_python_core.doc_writer.HydraCollection] = None, entrypoint: Optional[hydra_python_core.doc_writer.HydraEntryPoint] = None)

Class for JSON-LD context.

add(key: str, value: Union[Dict[str, str], str]) → None

Add entry to context.

createContext(object_: Dict[str, Any]) → None

Create the context for the given object.

generate() → Dict[str, Any]

Get as a python dict.

class hydra_python_core.doc_writer.EntryPointClass(class_: hydra_python_core.doc_writer.HydraClass)

Class for a Operation Entry to the EntryPoint object.

generate() → Dict[str, Any]

Get as Python Dict.

class hydra_python_core.doc_writer.EntryPointCollection(collection: hydra_python_core.doc_writer.HydraCollection)

Class for a Collection Entry to the EntryPoint object.

generate() → Dict[str, Any]

Get as a python dict.

class hydra_python_core.doc_writer.EntryPointOp(id_: str, method: str, desc: str, expects: Optional[str], returns: Optional[str], expects_header: List[str] = [], returns_header: List[str] = [], possible_status: List[Union[HydraStatus, HydraError]] = [], type_: Optional[str] = None, label: str = '')

supportedOperation for EntryPoint.

generate() → Dict[str, Any]

Get as Python Dict.

get_type(method: str) → str

Return @type for op based on method type.

class hydra_python_core.doc_writer.HydraClass(title: str, desc: str, path: str = None, endpoint: bool = True, sub_classof: None = None, _id: str = None)

Template for a new class.

add_supported_op(op: Union[EntryPointOp, HydraClassOp]) → None

Add a new supportedOperation.

Raises:

TypeError: If op is not an instance of HydraClassOp or EntryPointOp

add_supported_prop(prop: Union[HydraClassProp, EntryPointClass, EntryPointCollection]) → None

Add a new supportedProperty.

Raises:
TypeError: If prop is not an instance of HydraClassProp or EntryPointClass

or EntryPointCollection

generate() → Dict[str, Any]

Get the Hydra class as a python dict.

class hydra_python_core.doc_writer.HydraClassOp(title: str, method: str, expects: Optional[str], returns: Optional[str], expects_header: List[str] = [], returns_header: List[str] = [], possible_status: List[Union[HydraStatus, HydraError]] = [])

Template for a new supportedOperation.

generate() → Dict[str, Any]

Get the Hydra op as a python dict.

get_type(method: str) → str

Return @type for op based on method type.

class hydra_python_core.doc_writer.HydraClassProp(prop: Union[str, HydraLink], title: str, read: bool, write: bool, required: bool, desc: str = '', **kwargs)

Template for a new property.

generate() → Dict[str, Any]

Get the Hydra prop as a python dict.

class hydra_python_core.doc_writer.HydraCollection(collection_name: str = None, collection_path: str = None, collection_description: str = None, manages: Union[Dict[str, Any], List] = None, get: bool = True, post: bool = True, put: bool = True, delete: bool = True)

Class for Hydra Collection.

generate() → Dict[str, Any]

Get as a python dict.

class hydra_python_core.doc_writer.HydraCollectionOp(id_: str, type_: str, method: str, desc: str, expects: Optional[str], returns: Optional[str], expects_header: List[str] = [], returns_header: List[str] = [], possible_status: List[Union[HydraStatus, HydraError]] = [])

Operation class for Collection operations.

generate() → Dict[str, Any]

Get as a Python dict.

class hydra_python_core.doc_writer.HydraDoc(API: str, title: str, desc: str, entrypoint: str, base_url: str, doc_name: str)

Class for an API Doc.

add_baseCollection() → None

Add Collection class to the API Doc.

add_baseResource() → None

Add Resource class to the API Doc.

add_possible_status(status: Union[HydraStatus, HydraError]) → None

Add a new possibleStatus.

Raises:

TypeError: If status is not an instance of HydraStatus.

add_supported_class(class_: hydra_python_core.doc_writer.HydraClass) → None

Add a new supportedClass.

Raises:

TypeError: If class_ is not an instance of HydraClass

add_supported_collection(collection_: hydra_python_core.doc_writer.HydraCollection) → None

Add a supported Collection

Raises:

TypeError: If collection_ is not an instance of HydraCollection

add_to_context(key: str, value: Union[Dict[str, str], str]) → None

Add entries to the vocabs context.

gen_EntryPoint() → None

Generate the EntryPoint for the Hydra Doc.

generate() → Dict[str, Any]

Get the Hydra API Doc as a python dict.

class hydra_python_core.doc_writer.HydraEntryPoint(base_url: str, entrypoint: str)

Template for a new entrypoint.

add_Class(class_: hydra_python_core.doc_writer.HydraClass) → None

Add supportedProperty to the EntryPoint.

Raises:

TypeError: If class_ is not an instance of HydraClass.

add_Collection(collection: hydra_python_core.doc_writer.HydraCollection) → None

Add supportedProperty to the EntryPoint.

Raises:

TypeError: If collection is not an instance of HydraCollection.

generate() → Dict[str, Any]

Get as a Python dict.

get() → Dict[str, str]

Create the EntryPoint object to be returnd for the get function.

class hydra_python_core.doc_writer.HydraError(code: int, id_: str = None, title: str = '', desc: str = '')

Class for Hydra Error to represent error details.

generate() → Dict[str, Any]

Get error response body

class hydra_python_core.doc_writer.HydraIriTemplate(template: str, iri_mapping: List[hydra_python_core.doc_writer.IriTemplateMapping] = [], basic_representation: bool = True)

Class for hydra IriTemplates

generate() → Dict[str, Any]

Get IriTemplate as a python dict

Template for a link property.

add_supported_op(op: Union[EntryPointOp, HydraClassOp]) → None

Add a new supportedOperation.

Raises:

TypeError: If op is not an instance of HydraClassOp or EntryPointOp

generate() → Dict[str, Any]

Get the Hydra link as a python dict.

class hydra_python_core.doc_writer.HydraStatus(code: int, id_: str = None, title: str = '', desc: str = '')

Class for possibleStatus in Hydra Doc.

generate(status_type: str = 'Status') → Dict[str, Any]

Get as Python dict.

class hydra_python_core.doc_writer.IriTemplateMapping(variable: str, prop: str, required: bool = False)

Class for hydra IriTemplateMapping

generate() → Dict[str, Any]

Get IriTemplateMapping as a python dict