Skip to content

fix(generators): document all exported symbols in generated code (#141) - #330

Merged
lerenn merged 1 commit into
mainfrom
feat/141-generated-comments
Jun 12, 2026
Merged

lerenn merged 1 commit into
mainfrom
feat/141-generated-comments

Conversation

@lerenn

@lerenn lerenn commented Jun 12, 2026

Copy link
Copy Markdown
Owner

Issue

Fixes #141 — some generated functions/types were missing doc comments or had them incomplete.

Change

Generated files are skipped by the linter (DO NOT EDIT header), so these gaps were invisible to CI. Audit of every *.gen.go found a consistent set of exported symbols without a doc comment:

  • MessageWithCorrelationID interface
  • Error struct and its Error() method
  • the New<Message>() constructors
  • the Request{As,To}<Op> function — its doc comment was detached by a blank line, so Go treated it as not a doc comment

All are fixed in the v2/v3 types.tmpl, message.tmpl and v3 controller.tmpl. 111 golden files are regenerated with the added comments (comment-only changes).

Test

test/v3/issues/141 parses the generated asyncapi.gen.go with go/parser and asserts that every exported declaration (func, type, const, var) has a doc comment. It fails before the change (the symbols above lack docs) and passes after. The spec is a request-reply with correlation IDs so the Request function and the message/error types are all exercised.

🤖 Generated with Claude Code

Several exported symbols were generated without a doc comment
(MessageWithCorrelationID, Error, the Error() method and the message
constructors), and the Request* function's doc comment was detached from
it by a blank line. Add the missing comments and reattach the Request
comment so every exported declaration in generated code is documented.

Fixes #141

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@lerenn
lerenn force-pushed the feat/141-generated-comments branch from 6911a7c to 4872b24 Compare June 12, 2026 16:12
@lerenn
lerenn merged commit bd02a0e into main Jun 12, 2026
5 checks passed
@lerenn
lerenn deleted the feat/141-generated-comments branch June 12, 2026 16:15
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.

Add and fix function comments on generated code.

1 participant