知识卡片
范围操作符两侧取舍
把比较符放进键,例如 rating.gte 与 rating.lte,可让上下界分别出现,降低重复键的歧义。放进值可缩短参数名,但需要定义重复键或组合规则。无论选择哪种,写明是否包含边界。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Scaling collection endpoints with filters and pagination 17.2 Designing filters · 查看原书依据
There’s an advantage to putting the range indicator on the left or key side. Often an API consumer wants to provide two conditions to define an upper and a lower bound for the filter parameter; for example, all ratings from 2 to
参考来源
- 位置:《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,阅读块 69)
- 结论依据:原文对同一范围列了独立键、重复键和复杂值三种编码。
- 原始内容:There’s an advantage to putting the range indicator on the left or key side. Often an API consumer wants to provide two conditions to define an upper and a lower bound for the filter parameter; for example, all ratings from 2 to