知识卡片
结构验证与业务验证
Schema 能检查邮箱存在与格式,只有查真实状态才能确定是否重复。资源归属与权限同样依赖上下文。由框架先拒绝结构异常,服务再处理业务前提,并在 HTTP 边界汇总成约定的错误响应。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Supporting the unhappy path: Error handling with problem+json 18.7 Error-handling guidance · 查看原书依据
As an example, take the PetSitter backend, which uses OAS tools. It can automatically detect whether the user provided an email field and whether that field contains an email address (although we still have to teach it that trick, which we’ll do
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第18章《Supporting the unhappy path: Error handling with problem+json》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch18.htm,阅读块 199)
- 结论依据:书中用邮箱形状与是否已注册区分两类判断。
- 原始内容:As an example, take the PetSitter backend, which uses OAS tools. It can automatically detect whether the user provided an email field and whether that field contains an email address (although we still have to teach it that trick, which we’ll do