知识卡片
对象查询参数序列化
用查询对象把一组筛选条件放在同一参数下。OpenAPI deepObject 可表达类似 pets[age_below] 的浅层字段。明确序列化方式并做真实客户端验证,多层对象和数组需要单独约定。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Scaling collection endpoints with filters and pagination 17.3 Filters for PetSitter · 查看原书依据
Apart from adding type: object, however, we also have to specify how we want the object serialized into key/value pairs. For this purpose, there’s the style keyword, and by default OpenAPI assumes the form style. This style flattens the object, which means
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第17章《Scaling collection endpoints with filters and pagination》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch17.htm,阅读块 194)
- 结论依据:例子比较表单扁平化和 deepObject 的方括号前缀。
- 原始内容:Apart from adding type: object, however, we also have to specify how we want the object serialized into key/value pairs. For this purpose, there’s the style keyword, and by default OpenAPI assumes the form style. This style flattens the object, which means