datanator_rest_api.spec package

Submodules

datanator_rest_api.spec.SpecUtils module

Datanator API Utils

Author

Bilal Shaikh <bilalshaikh42@gmail.com>

Date

2019-08-16

Copyright

2019, Karr Lab

License

MIT

class datanator_rest_api.spec.SpecUtils.SpecUtils[source]

Bases: object

static parseAPI(api_dir: str = './datanator_rest_api/spec/', src_file: str = 'root.yaml')[source]
Takes the root open api yaml file and resolves the embedded refrences for local and remote yaml files.

Generates a complete JSON specification of the API

Parameters
  • api_dir (str) – The directory storing the api definition

  • src_file (str) – The name of the root api file

Returns

A string containing the parsed API

Return type

str

static uploadAPI(api_file)[source]
static validateAPI(res_api: str)[source]

Opens the API specification and validates against the open api schema

Parameters

res_api (str) – A string containing the resolved API definition

Raises
  • OpenAPIValidationError – The provided specification is invalid

  • ExtraParametersError – A required paramter has no corresponding properties description

  • ParameterDuplicateError – A parameter has been included more than once in the definition

  • UnresolvableParamaterError

static writeAPI(res_api, dst_file)[source]

A simple wrapper for file writing. Takes in a resolved api definition and writes it to a file.

Parameters
  • res_api (str) – The API with refrences resolved

  • dst_file (str) – The path for the OpenAPI Specification file to write

Module contents

API init

Author

Bilal Shaikh <bilalshaikh42@gmail.com>

Date

2019-08-16

Copyright

2019, Karr Lab

License

MIT