Skip to content

.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
virus-16:2
Closed

.2385318931605690:9d47297429b3c75d176feb36cb215811_69f70b11eb4415a9574e5ea1.69f71faeeb4415a9574e620d.69f71fad5c05003d50417a5a:Trae CN.T(2026/5/3 18:13:02)#9965
virus-16 wants to merge 2 commits intoencode:mainfrom
virus-16:2

Conversation

@virus-16
Copy link
Copy Markdown

@virus-16 virus-16 commented May 3, 2026

fix(exceptions): 正确处理非字段错误的对象路径

修改 _flatten_errors 函数,当遇到 NON_FIELD_ERRORS_KEY 时不再将键名加入路径,使对象级错误能正确映射到父对象路径。这便于前端直接在对应对象/区域显示这些错误。

virus-16 added 2 commits May 3, 2026 17:25
为序列化器和API异常添加get_flattened_errors和get_errors_with_field_paths方法,方便前端处理嵌套结构的错误信息。新增_flatten_errors和_get_errors_with_field_paths工具函数实现错误信息的扁平化处理和按字段路径分组。
修改 _flatten_errors 函数,当遇到 NON_FIELD_ERRORS_KEY 时不再将键名加入路径,使对象级错误能正确映射到父对象路径。这便于前端直接在对应对象/区域显示这些错误。
Copy link
Copy Markdown
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not spam here

@auvipy auvipy closed this May 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants