Skip to content

feat(client): improve generated Godoc - #2407

Merged
jamietanna merged 8 commits into
mainfrom
feat/client-docs
Jun 17, 2026
Merged

jamietanna merged 8 commits into
mainfrom
feat/client-docs

Conversation

@jamietanna

@jamietanna jamietanna commented Jun 14, 2026

Copy link
Copy Markdown
Member

I've noted this as "breaking" as it changes the way that an existing templating function works

@jamietanna

Copy link
Copy Markdown
Member Author

I've split #2406 out of this one

@mromaszewicz

Copy link
Copy Markdown
Member

I think it's a nice looking improvement in terms of comments. The templates get a tiny bit more complex, but I think that's ok.

@mromaszewicz

Copy link
Copy Markdown
Member

@greptileai please review this draft.

@greptile-apps

greptile-apps Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR improves the generated Godoc for clients, servers, and response wrappers. The main changes are:

  • Adds operation-focused comments for generated client methods and interfaces.
  • Adds clearer response wrapper and response-body getter documentation.
  • Prefixes generated server handler comments with the exported method name.
  • Updates generated examples and golden test outputs to match the new docs.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the latest changed code.
  • The latest push only updates generated GetBody comment wording and its source template.
  • No runtime paths, generated signatures, response parsing, or request behavior changed in this update.

Important Files Changed

Filename Overview
pkg/codegen/templates/client-with-responses.tmpl Updates the generated GetBody comment text without changing emitted code behavior.

Reviews (10): Last reviewed commit: "chore(client): remove unnecessary `(Body..." | Re-trigger Greptile

Comment thread pkg/codegen/templates/client.tmpl Outdated
Comment thread pkg/codegen/templates/client-with-responses.tmpl Outdated
Comment thread pkg/codegen/templates/client-with-responses.tmpl Outdated
@jamietanna
jamietanna force-pushed the feat/client-docs branch 2 times, most recently from 13b5a09 to 5925f8c Compare June 15, 2026 17:28
@jamietanna jamietanna added ☢️ breaking change This change would break existing users' code notable changes Used for release notes to highlight these more highly labels Jun 16, 2026
Comment thread pkg/codegen/templates/chi/chi-interface.tmpl
@jamietanna
jamietanna force-pushed the feat/client-docs branch 3 times, most recently from 4fa8d8a to 1b04b33 Compare June 16, 2026 21:09
Comment thread pkg/codegen/templates/client.tmpl
Comment thread pkg/codegen/templates/client-with-responses.tmpl
@jamietanna
jamietanna force-pushed the feat/client-docs branch 2 times, most recently from 31b99d9 to 4cbcee1 Compare June 17, 2026 07:53
Comment thread pkg/codegen/operations.go
@jamietanna
jamietanna force-pushed the feat/client-docs branch 3 times, most recently from a2a3f8d to 608534d Compare June 17, 2026 08:30
@jamietanna

Copy link
Copy Markdown
Member Author

@greptileai review

@jamietanna
jamietanna marked this pull request as ready for review June 17, 2026 08:33
@jamietanna
jamietanna requested a review from a team as a code owner June 17, 2026 08:33
@jamietanna jamietanna mentioned this pull request Jun 17, 2026
jamietanna and others added 5 commits June 17, 2026 09:42
To make sure that the comments show up as Godoc for IDEs, the convention
is that the first word of the comment should be the function name.

With help from Claude Sonnet to add test coverage, and ensure that no
stray whitespace can be injected.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
As a follow-up from c5641fd, we can
improve this wording, so it's a little clearer.

This makes it a little clearer what this getter is doing - returning
the response body for a given HTTP response and media type - rather than
reiterating what type is returned.
To align with the comment on the helper function, if enabled, too.
To make it easier for folks to work with the generated code we produce
for API clients, we should make a few tweaks to improve the output:

- Provide a better default Godoc if we don't have a `summary`
- Ensure the `ClientInterface` and `ClientWithResponsesInterface`
  include Godoc, too
- Generate a more in-depth Godoc when we do have a `summary` and/or
  `description`

This introduces new helper functions to simplify the rendering in Go,
rather than introducing complex templating.

With help from Claude Sonnet to add test coverage.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
@jamietanna

Copy link
Copy Markdown
Member Author

@greptileai review

@jamietanna
jamietanna merged commit 13b9c9a into main Jun 17, 2026
28 checks passed
@jamietanna
jamietanna deleted the feat/client-docs branch June 17, 2026 09:15
@greptile-apps

greptile-apps Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Want your agent to iterate on Greptile's feedback? Try greploops.

@mromaszewicz mromaszewicz removed the ☢️ breaking change This change would break existing users' code label Jul 16, 2026
@mromaszewicz

Copy link
Copy Markdown
Member

I've removed "breaking change" since we've generally not bothered about flagging template changes. Pretty much everything is a breaking change if we follow that convention.

@mromaszewicz mromaszewicz removed the notable changes Used for release notes to highlight these more highly label Jul 16, 2026
@jamietanna jamietanna added the enhancement New feature or request label Jul 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants