anomaly / anomaly/lab-python-server

Explore the option of sending partial entities as responses

未关闭
#28 0 条评论 0 个 reaction 已指派 1 人 已被 @devraj 认领 在 GitHub 查看
主要语言
Python
星标
16
派生
4
PR 合并指标
30 天内没有已合并 PR

描述

This is something I miss from my `prestans` days, we have a [feature](https://prestans.readthedocs.io/en/latest/validation.html#attribute-filters) we called `attribute_filters` it essentially allowed us toggle the visibility of fields in responses. What this allowed is to use the same model for different use cases e.g:

- List of users in the master view only needs, `id`, `name`, `email`
- Clicking a user then loads the entire user including children model (this is the heavy weight use case)

Pydantic has the idea of [excluding](https://pydantic-docs.helpmanual.io/usage/exporting_models/#advanced-include-and-exclude) keys when it serializes content.

Explore and document:
- if this is possible using the FastAPI + pydantic toolset
- is this an OK thing to do according the OpenAPI specification

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。