.2385318931605690:9d47297429b3c75d176feb36cb215811_69f70b11eb4415a9574e5ea1.69f71faeeb4415a9574e620d.69f71fad5c05003d50417a5a:Trae CN.T(2026/5/3 18:13:02)#9965
Closed
virus-16 wants to merge 2 commits intoencode:mainfrom
Closed
Conversation
为序列化器和API异常添加get_flattened_errors和get_errors_with_field_paths方法,方便前端处理嵌套结构的错误信息。新增_flatten_errors和_get_errors_with_field_paths工具函数实现错误信息的扁平化处理和按字段路径分组。
修改 _flatten_errors 函数,当遇到 NON_FIELD_ERRORS_KEY 时不再将键名加入路径,使对象级错误能正确映射到父对象路径。这便于前端直接在对应对象/区域显示这些错误。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(exceptions): 正确处理非字段错误的对象路径
修改 _flatten_errors 函数,当遇到 NON_FIELD_ERRORS_KEY 时不再将键名加入路径,使对象级错误能正确映射到父对象路径。这便于前端直接在对应对象/区域显示这些错误。