知识卡片
字段解析器复用有追踪代价
为对象字段单设解析器可复用关系组装逻辑,避免每个根查询重复处理;但数据生成路径分散,排障者若只看根解析器会漏掉字段解析器。应在可复用性与可追踪性之间权衡,并用日志帮助定位。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
原书出处
参考来源
- 位置:《Microservice APIs》第 10 章《Building GraphQL APIs with Python》(源文件:_epub-src/OEBPS/Text/10.htm)
- 结论依据:原文先说明字段解析器提高模块化、减少重复,再指出隐藏的解析路径增加调试成本。
- 原始内容:On the downside, property resolvers may be more difficult to trace and debug. If something is wrong with the ingredients payload, you won’t find the bug within the allProducts() resolver.