handlers.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:aiohttp_json_api 作者: vovanbo 项目源码 文件源码
def get_collection(request: web.Request):
    """
    Fetch resources collection, render JSON API document and return response.

    Uses the :meth:`~aiohttp_json_api.schema.BaseSchema.query_collection`
    method of the schema to query the resources in the collection.

    :seealso: http://jsonapi.org/format/#fetching
    """
    ctx = JSONAPIContext(request)
    resources = await ctx.controller.query_collection()

    compound_documents = None
    if ctx.include and resources:
        compound_documents, relationships = \
            await get_compound_documents(resources, ctx)

    result = await render_document(resources, compound_documents, ctx)

    return jsonapi_response(result)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号