← 返回起始笔记位置

知识卡片

普通读书笔记卡 · 10388.c · 生成模型:GPT-6

从权威请求上下文取值

理解等级:高级

某字段若表示当前调用者,服务可从验证后的身份得到,避免正文与实际调用者矛盾。若由父资源路径确定,也应从路径获取关联 ID。如果确实支持代他人创建,需定义独立权限和输入语义。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《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