ebonite.runtime.openapi.spec module

ebonite.runtime.openapi.spec.make_object(properties: List[pyjackson.core.Field] = None, arbitrary_properties_type: Type[CT_co] = None, has_default=False, default=None)[source]

Converts object type described as list of fields to OpenAPI schema definition

Parameters:
  • properties – fields of object
  • arbitrary_properties_type – (optional) required type for properties which are not specified in properties
  • has_default – specifies whether given type has default value
  • default – specifies default value for given type
Returns:

dict with OpenAPI schema definition

ebonite.runtime.openapi.spec.make_array(item_type: Type[CT_co], minimum_size=None, maximum_size=None, has_default=False, default=None)[source]

Converts array type described as type of its items and range of possible sizes to OpenAPI schema definition

Parameters:
  • item_type – type of items in array
  • minimum_size – minimal possible size of array
  • maximum_size – maximal possible size of array
  • has_default – specifies whether given type has default value
  • default – specifies default value for given type
Returns:

dict with OpenAPI schema definition

ebonite.runtime.openapi.spec.type_to_schema(field_type, has_default=False, default=None)[source]

Facade method converting arbitrary type to OpenAPI schema definitions. Has special support for builtins, collections and instances of TypeWithSpec subclasses.

Parameters:
  • field_type – type to generate schema for
  • has_default – specifies whether given type has default value
  • default – specifies default value for given type
Returns:

dict with OpenAPI schema definition

ebonite.runtime.openapi.spec.create_spec(method_name: str, signature: pyjackson.core.Signature, name: str, docs: str)[source]

Generates OpenAPI schema definition for given method

Parameters:
  • method_name – name of method
  • signature – types of arguments and type of return value
  • name – name of the interface
  • docs – docs for method
Returns:

dict with OpenAPi schema definition