Skip to content

codegen: warn when custom attribute rules match nothing - #730

Open
vladislav-miroshnikov wants to merge 1 commit into
anthropics:mainfrom
vladislav-miroshnikov:vmiroshnikov/unmatched-attributes
Open

vladislav-miroshnikov wants to merge 1 commit into
anthropics:mainfrom
vladislav-miroshnikov:vmiroshnikov/unmatched-attributes

Conversation

@vladislav-miroshnikov

Copy link
Copy Markdown

A typo in a custom attribute path just makes the attribute disappear from the generated code, with no hint why. For something like serde(skip) that quietly changes behavior.

This adds a CustomAttributeRuleMatchedNothing warning for each entry in the six custom attribute lists that didn't apply anywhere. The warning says which list it came from and the proto path as configured. Matches are recorded where the attributes are actually emitted and collected across all requested files, so a rule that matches in only one of them isn't reported.

Generated code itself doesn't change. The tests cover the different target kinds, duplicate rules, imports, and excluded and synthetic descriptors, and check that the output stays the same. Lint, tests, all-features, arbitrary and docs pass on Linux.

Fixes #697.

@github-actions

github-actions Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@vladislav-miroshnikov

Copy link
Copy Markdown
Author

recheck

This branch has not been deployed

No deployments
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.

codegen: an attribute rule (type_attribute, field_attribute, oneof_struct_field_attribute, …) that matches nothing produces no warning

1 participant