errors: reformat pydantic validation error (CRAFT-368)
Metadata
Current evaluation
Merged after reviewer approval and passing CI. Reformatted Pydantic validation errors for improved readability. Centralized formatting in charmcraft while preserving standalone craft-parts error handling.
Suggested action: —
No scores available.
Issue body
Change formatting of pydantic errors to be more human-readable. The
new format is similar to the one used in Charmcraft. Specifically,
this changes
```
'foo',1: some error happened
'bar': field required
'baz': extra fields not permitted
```
to
```
- some error happened in field 'foo[1]'
- field 'bar' is required'
- extra field 'baz' not permitted
```
Co-authored-by: Chris Patterson <chris.patterson@canonical.com>
Signed-off-by: Claudio Matsuoka <claudio.matsuoka@canonical.com>
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged after reviewer approval and passing CI. Reformatted Pydantic validation errors for improved readability. Centralized formatting in charmcraft while preserving standalone craft-parts error handling. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Reformatted pydantic validation errors for better readability. Formatting was centralized in charmcraft to avoid duplication. The PR was held pending final craft-parts integration to prevent error leakage before merging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #167 errors: update pydantic validation error checking (CRAFT-788) | craft-parts | merged | Merged update to align craft-parts with Pydantic 1.9 by replacing plain dictionary error handling with TypedDict. Approved by reviewer, passed CI, and modified six files to correctly parse ErrorDict validation data. | |
| #600 fix: don't raise CraftValidationErrors in validators | rockcraft | merged | Merged. Validators now raise standard Pydantic errors instead of CraftValidationErrors, allowing Pydantic to group them into a single ValidationError for uniform reporting. Approved by two reviewers and passed CI. | |
| #601 feat: upgrade to pydantic 2.x | craft-parts | closed | The pydantic 2.x upgrade for craft-parts was closed as superseded after addressing review feedback on validation error reporting. The changes were replaced by a newer update. | |
| #168 release: craft-parts 1.1.2 | craft-parts | merged | Merged release craft-parts 1.1.2. Unpins pydantic and pylint dependencies, fixes setup.py URL, resolves pydantic validation error handling, and removes unused requirements files. Approved by reviewer and passed CI checks. | |
| #1622 fix: reorganise charmcraft.yaml preprocessing | charmcraft | merged | Merged following two approvals and passing CI. Reorganized charmcraft.yaml preprocessing to apply extensions on raw data, assign default parts to charms with bases, and enforce dictionary type for parts. Modified 5 files (+27/-14 lines). | |
| #160 release: craft-parts 1.1.1 | craft-parts | merged | Merged craft-parts 1.1.1 release after reviewer approval and passing CI. Updates pin pydantic and pydantic-yaml dependency versions across five files to stabilize builds. |