schema: improve invalid app, hook, and part errors
Metadata
Current evaluation
PR #1615 merged as commit baef97109: added custom in-schema validation errors so invalid app, hook, and part names report a clear 'invalid name' message instead of jsonschema's 'Additional properties are not allowed'. Fixes LP bug #1606890.
Resolution: closed resolved
Reason: The PR was approved by 2 reviewers and merged into snapcraft as commit baef97109 ('schema: improve invalid app, hook, and part errors (#1615)'), which replaced the cryptic additionalProperties jsonschema error with explicit pattern-based validation errors in the schema, closing LP bug #1606890.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
Currently, when one attempts to use an invalid app, hook, or part name, rather than saying something about it being an invalid name because it didn't match the regex, jsonschema uses the `additionalProperties` validator, which makes the error message extra awful, e.g.:
Issues while validating snapcraft.yaml: The 'apps' property does not match the required schema: Additional properties are not allowed ('invalid_app_name' was unexpected)
This PR fixes LP: [#1606890](https://bugs.launchpad.net/snapcraft/+bug/1606890) by improving these messages, adding custom in-schema validation errors for them instead of relying on jsonschema.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | PR #1615 merged as commit baef97109: added custom in-schema validation errors so invalid app, hook, and part names report a clear 'invalid name' message instead of jsonschema's 'Additional properties are not allowed'. Fixes LP bug #1606890. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1615 in commit baef97109, replacing cryptic jsonschema errors for invalid app, hook, and part names with clearer custom schema errors. Fixes Launchpad bug #1606890. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged changes improve validation error messages for invalid app, hook, and part names in snapcraft.yaml. Replaces confusing jsonschema errors with custom validation messages, resolving Launchpad bug #1606890. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged. Replaced jsonschema's generic additionalProperties error messages with custom validation errors for invalid app, hook, and part names in snapcraft.yaml, improving user feedback. Fixes Launchpad bug #1606890. |
Update history
No update history recorded yet.
Related issues
No related issues found above the similarity threshold.