知识卡片
从权威请求上下文取值
某字段若表示当前调用者,服务可从验证后的身份得到,避免正文与实际调用者矛盾。若由父资源路径确定,也应从路径获取关联 ID。如果确实支持代他人创建,需定义独立权限和输入语义。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Improving input validation with advanced JSON Schema 19.3 Updating PetSitter schemas · 查看原书依据
In general, that is correct. In this particular case, however, the server also sets creator_user_id based on the ID of the currently authenticated user. The business logic doesn’t allow entry of any other user, so read-only is valid in our case. If
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第19章《Improving input validation with advanced JSON Schema》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch19.htm,阅读块 119)
- 结论依据:示例让创建者从已认证身份得到,并说明管理员代办会改变规则。
- 原始内容:In general, that is correct. In this particular case, however, the server also sets creator_user_id based on the ID of the currently authenticated user. The business logic doesn’t allow entry of any other user, so read-only is valid in our case. If