flask_restful_dbbase.doc_utils.MetaDoc

class flask_restful_dbbase.doc_utils.MetaDoc(resource_class, requirements=None, methods=None)[source]

Bases: object

This class provides a scaffolding for holding documentation used when generating meta documents.

The goal of a meta document is to provide a standard way to communicate the features of the backend API to frontend users.

Resource header:

model_class url_prefix base_url requirements

Resource methods:
single: get/post/put/patch/delete

input input_modifier before_commit (if applicable) after_commit (if applicable) responses (if applicable)

collection: get

query input_modifier

Parameters:
  • resource_class – (obj) : The resource documented

  • requirements – (str) : The input requirements documented

  • methods – (list|dict) : a list or dict of methods that have special requirements. Leaving None would mean the default documentation.

__init__(resource_class, requirements=None, methods=None)[source]

Methods

__init__(resource_class[, requirements, methods])

add_methods(doc, method)

to_dict([method])

This function returns the settings for the resource.

Attributes

all_methods

to_dict(method=None)[source]

This function returns the settings for the resource.

Parameters:

method – (str : None) : choices are get/post/put/patch/delete.

Returns:

meta_data (dict) – A dict with the resource characteristics. If a method is preferred, the focus will be narrowed to that method.

The intent of this function is to show relevant information for someone interacting with an API.