← 返回刚才阅读的位置

知识卡片

问题卡 · 4927.a.1.d

嵌入控件表达当前动作

理解等级:中级

服务需要调整交互地址、输入规则或工作流,而旧客户端不能随每次调整重写请求时,可把这些细节放入响应控件。

响应把动作地址、方法、字段及校验规则嵌入控件,客户端按已约定格式解释它们。例如表单可声明givenName和familyName必填、telephone匹配十位数字,以及提交地址和编码;字段、权限上下文和流程步骤可随运行期状态变化。前提是双方支持同一格式及领域词汇;新增机器无法提供的语义输入仍需协调。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 超媒体接口设计 · 查看原书依据

      So the number of inputs, the destination URL of the HTTP POST, and even some of the rules can all change over time, and the API consumer application can still reliably enforce the constraints. For example, the validation rule for the telephone value can change (e.g., it might be context dependent based on where the application is running).

    参考来源

    - 位置:《RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)》第03章《超媒体接口设计》(来源项目 book-sources;源文件:extracted/RESTful Web API Patterns and Practices Cookbook Connecting and Orchestrating Microservices and Distributed Data (Mike Amundsen)/_epub-src/OEBPS/ch03.xhtml;小节:3.5) - 结论依据:原文以响应把动作地址、方法、字段及校验规则嵌入控件,客户端按已约定格式解释它们的机制或场景为依据;同小节余文补充本卡所列条件,按2022年原书语境整理。 - 原始内容:So the number of inputs, the destination URL of the HTTP POST, and even some of the rules can all change over time, and the API consumer application can still reliably enforce the constraints. For example, the validation rule for the telephone value can change (e.g., it might be context dependent based on where the application is running).