示例#1
0
def body_param(schema):
    return swagger.BodyParameter(**{
        "name": "body",
        "in": "body",
        "schema": swagger.JsonReference({
            "$ref": "#/definitions/{}".format(type_name(name_for(schema))),
        }),
    })
示例#2
0
def build_response(description, resource=None):
    """
    Build a response definition.

    """
    response = swagger.Response(description=description, )
    if resource is not None:
        response.schema = swagger.JsonReference({
            "$ref":
            "#/definitions/{}".format(type_name(name_for(resource))),
        })
    return response