Skip to content

fix: correctly set deprecated Godoc where necessary - #2405

Merged
jamietanna merged 3 commits into
mainfrom
fix/deprecated
Jun 17, 2026
Merged

jamietanna merged 3 commits into
mainfrom
fix/deprecated

Conversation

@jamietanna

@jamietanna jamietanna commented Jun 13, 2026 •

Copy link
Copy Markdown
Member

No description provided.

@jamietanna
jamietanna force-pushed the fix/deprecated branch 3 times, most recently from d471034 to c390cb3 Compare June 14, 2026 07:40
@jamietanna

Copy link
Copy Markdown
Member Author

@greptileai review

@greptile-apps

greptile-apps Bot commented Jun 14, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds deprecation support to generated OpenAPI code. The main changes are:

  • Emits Go deprecation comments for deprecated schemas, properties, parameters, operations, headers, and request body aliases.
  • Propagates deprecated operation metadata onto generated request body type aliases.
  • Updates client, server, strict server, and response templates to include deprecation comments.
  • Adds a deprecation-focused internal test fixture and regenerated golden output.

Confidence Score: 5/5

This looks safe to merge.

  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
pkg/codegen/operations.go Adds operation deprecation propagation for request body definitions and preserves existing generation order.
pkg/codegen/schema.go Adds explicit typedef-level deprecation comments while keeping schema-level deprecation behavior intact.
pkg/codegen/templates/request-bodies.tmpl Emits sanitized deprecation comments above generated request body aliases.

Reviews (4): Last reviewed commit: "fix: propagate **??**" | Re-trigger Greptile

@jamietanna

Copy link
Copy Markdown
Member Author

@greptileai review

As part of future changes, we'll be improving how `oapi-codegen`
generates deprecation notices through godoc.

Before we do this, we can introduce a more in-depth test case for the
different areas that can be marked as deprecated, so we can validate the
functionality.

With help from

As a starting point from **??**, we can then extend this to:

- Cover at least an HTTP client and server
- Add Strict Server functionality
- Deprecate a parameter
- Generate a deprecation on `components/response`

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

Copy link
Copy Markdown
Member Author

@greptileai review

jamietanna and others added 2 commits June 17, 2026 19:42
Previously, we would miss rendering a deprecation notice in Godoc for
API types, fields and HTTP routes in our generated client, which makes
it harder for users to be aware of deprecated functionality they're
relying upon.

We can make sure to introduce `DeprecationComment` functions where
necessary, and call it when rendering templates.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
In the case that we have type aliases that are deprecated (because the
type they're pointing to, are also deprecated), we were previously not
marking the type alias as deprecated, too.

Co-authored-by: Claude Sonnet 4.6 <jamie.tanna+claude-code@rootly.com>
@jamietanna jamietanna changed the title fix/deprecated fix: correctly set deprecated Godoc where necessary Jun 17, 2026
@jamietanna jamietanna added bug Something isn't working enhancement New feature or request notable changes Used for release notes to highlight these more highly labels Jun 17, 2026
@jamietanna
jamietanna marked this pull request as ready for review June 17, 2026 18:48
@jamietanna
jamietanna requested a review from a team as a code owner June 17, 2026 18:48
@jamietanna
jamietanna merged commit e0c967b into main Jun 17, 2026
31 checks passed
@jamietanna
jamietanna deleted the fix/deprecated branch June 17, 2026 18:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request notable changes Used for release notes to highlight these more highly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant