Add deprecated section to changelog generator#93
Open
cb-alish wants to merge 1 commit into
Open
Conversation
The CHANGELOG and CHANGELOG_DOCS generators currently surface only additions, deletions, enum changes, and parameter-requirement flips. Spec changes that flip a resource, action, attribute, or parameter from active to `deprecated: true` were silently dropped, leaving SDK consumers without a heads-up before the eventual removal. This change detects fresh deprecation transitions (was present and not deprecated in the old spec, now deprecated in the new spec) and renders them in dedicated sections of both outputs: - `Resource.isDeprecated()` reads the schema `deprecated` flag. - `ChangeLogEntry.EntryType` gains DEPRECATED_RESOURCE/ACTION/ ATTRIBUTE/PARAMETER variants, with matching list fields on `ChangeLogSchema` and `ChangeLogDocsSchema`. - `ChangeLogGenerator` and `ChangeLogDocsGenerator` collect the previous deprecation state per resource/action/parameter (with nested-parameter traversal) and emit entries only on a not->yes transition, so brand-new + already-deprecated items remain under the existing `New ...` sections. - `LocalDocsAvailabilityChecker` verifies the four new entry types against the local docs repo using the same rules as their add/delete counterparts and reports them in MISSING_DOCS.txt. - Both Handlebars templates render the new sections. Verified end-to-end against the production spec URLs; the diff now includes the `update_payment_method` deprecation on `HostedPage` that was previously missing. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
cb-karthikp
approved these changes
Jun 15, 2026
There was a problem hiding this comment.
PR Complexity Score: 7.2 - Complex
View Breakdown
- Lines Changed: 694
- Files Changed: 9
- Complexity Added: 102
- Raw Score: 193.88
Overview
This PR extends the changelog generation to include deprecation events for resources, actions, attributes, and parameters, both in markdown and docs formats. It introduces detection logic for newly deprecated items based on OpenAPI metadata and wires them into existing schemas, generators, and templates. It also updates the docs availability checker so deprecation entries are only emitted when corresponding documentation exists.
Key Changes
- Adds
Resource.isDeprecated()to surface the OpenAPIdeprecatedflag on resources. - Enhances
ChangeLogDocsGeneratorandChangeLogGeneratorto:- Detect resources that have become deprecated since the previous spec.
- Detect actions whose operations have newly become deprecated.
- Detect attributes that have newly become deprecated.
- Detect both top-level and nested parameters (query and request body) that have newly become deprecated, using dot-path notation.
- Extends
ChangeLogEntry.EntryType,ChangeLogDocsSchema, andChangeLogSchemawith new categories for deprecated resources, actions, attributes, and parameters, and integrates them into collection/partition logic. - Updates
LocalDocsAvailabilityCheckerto validate the presence and describe missing docs for the new deprecation entry types (resource dirs, action files, attribute slugs, and parameter slugs). - Updates the Handlebars templates for markdown and docs output to render new sections for Deprecated Resources, Deprecated Actions, Deprecated Attributes, and Deprecated Parameters.
Risks & Considerations
- Path construction for nested parameters (e.g.,
parent.child) must stay consistent between deprecation maps, slug generation, and docs anchors; any mismatch could cause false positives/negatives for deprecation detection or doc existence checks. - Deprecation detection relies on the
deprecatedflag in the OpenAPI schemas; incorrect or missing flags in the spec could result in incomplete or noisy changelogs. - The new logic assumes that an item existed previously and was non-deprecated to consider it “newly deprecated”; edge cases where items are added already deprecated will still be logged as deprecations.
- Additional deprecation entry types now require corresponding doc artifacts; missing docs will cause entries to be filtered out or reported via the availability checker, which may affect CI if that is enforced.
File-level change summary
| File | Change summary |
|---|---|
| src/main/java/com/chargebee/openapi/Resource.java | Adds an isDeprecated() helper to reflect the OpenAPI schema’s deprecated flag on resources. |
| src/main/java/com/chargebee/sdk/changelog/generators/ChangeLogDocsGenerator.java | Extends docs changelog generation to compute, partition, and output deprecation entries for resources, actions, attributes, and parameters, including nested parameter handling and deprecation maps. |
| src/main/java/com/chargebee/sdk/changelog/generators/ChangeLogGenerator.java | Extends markdown changelog generation with lines for newly deprecated resources, actions, attributes, and parameters, including deduplication and nested parameter path handling. |
| src/main/java/com/chargebee/sdk/changelog/generators/LocalDocsAvailabilityChecker.java | Adds availability checks and missing-doc descriptions for the new deprecation entry types and marks them as requiring published resources. |
| src/main/java/com/chargebee/sdk/changelog/models/ChangeLogDocsSchema.java | Adds list fields to hold deprecation entries for resources, actions, attributes, and parameters in the docs schema. |
| src/main/java/com/chargebee/sdk/changelog/models/ChangeLogEntry.java | Extends the EntryType enum with values for deprecated resources, actions, attributes, and parameters. |
| src/main/java/com/chargebee/sdk/changelog/models/ChangeLogSchema.java | Adds list fields to hold deprecation lines for resources, actions, attributes, and parameters in the markdown schema. |
| src/main/resources/templates/changelog/changelog.md.hbs | Updates the markdown template to render separate sections for deprecated resources, actions, attributes, and parameters when present. |
| src/main/resources/templates/changelog/changelog_docs.txt.hbs | Updates the docs template to append lines for deprecated resources, actions, attributes, and parameters when present. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CHANGELOGandCHANGELOG_DOCSgenerators previously surfaced only adds, deletes, enum changes, and parameter-requirement flips. Spec changes that flipped a resource, action, attribute, or parameter from active todeprecated: truewere silently dropped, leaving SDK consumers without a heads-up before the eventual removal.CHANGELOG.md) and the docs index (index.txt), populated only on a real not-deprecated → deprecated transition (brand-new entities that arrive already deprecated stay in theNew ...sections).Resource.isDeprecated()helper, four newChangeLogEntry.EntryTypes, matching list fields on both schemas, generator logic with nested-parameter traversal,LocalDocsAvailabilityCheckercoverage (soMISSING_DOCS.txtreports missing slugs for deprecated entries), and both Handlebars templates.Test plan
./gradlew compileJava./gradlew test --tests "*Resource*" --tests "*ChangeLog*"Output now includes:
[list]Endpoint ... has been deprecated.[]line in theCHANGELOG_DOCSoutput.Made with Cursor