@app.route('/_docs', methods=['GET'])
def clay_docs():
    headers = {'Content-type': 'application/json'}
    response = {
        'apiVersion': '0.2',
        'swaggerVersion': '1.2',
        'basePath': config.get('docs.base_path', None) or request.url_root.rstrip('/'),
        'resourcePath': '/',
        'apis': [],
        'models': {},
    }

    for rule in app.url_map.iter_rules():
        if rule.endpoint == 'static':
            continue

        api = {
            'path': rule.rule,
            'operations': [],
        }
        view_func = app.view_functions[rule.endpoint]
        if view_func.__doc__:
            docstring = view_func.__doc__.strip('\r\n\t ')
            params, responses, stripped_docstring, rtype = parse_docstring(docstring)

            shortdoc = [x for x in docstring.split('\n') if x]
            if not shortdoc:
                shortdoc = 'Undocumented'
            else:
                shortdoc = shortdoc[0]
        else:
            shortdoc = 'Undocumented'
            params = []
            responses = []
            stripped_docstring = shortdoc
            rtype = None


        for http_method in rule.methods:
            if http_method in ('HEAD', 'OPTIONS'):
                continue
            doc = {
                'method': http_method,
                'nickname': view_func.__name__,
                'summary': shortdoc,
                'notes': stripped_docstring,
                'parameters': params,
                'responseMessage': responses,
            }
            if rtype:
                doc['responseClass'] = rtype
                model = get_model(rtype)
                response['models'][rtype] = model

            api['operations'].append(doc)
        response['apis'].append(api)

    return (json.dumps(response, indent=2), 200, headers)
Returns the alt of this source object.
dataset/ETHPy150Open uber/clay/clay/docs.py/clay_docs--crossover with--dataset/ETHPy150Open lektor/lektor/lektor/db.py/Record.alt