Skip to content

Add deprecated section to changelog generator#93

Open
cb-alish wants to merge 1 commit into
mainfrom
feat/changelog-deprecated-section
Open

Add deprecated section to changelog generator#93
cb-alish wants to merge 1 commit into
mainfrom
feat/changelog-deprecated-section

Conversation

@cb-alish

@cb-alish cb-alish commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The CHANGELOG and CHANGELOG_DOCS generators previously surfaced only adds, deletes, enum changes, and parameter-requirement flips. Spec changes that flipped 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 PR adds dedicated Deprecated Resources / Actions / Attributes / Parameters sections to both the Markdown changelog (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 the New ... sections).
  • Touches: Resource.isDeprecated() helper, four new ChangeLogEntry.EntryTypes, matching list fields on both schemas, generator logic with nested-parameter traversal, LocalDocsAvailabilityChecker coverage (so MISSING_DOCS.txt reports missing slugs for deprecated entries), and both Handlebars templates.

Test plan

  • ./gradlew compileJava
  • ./gradlew test --tests "*Resource*" --tests "*ChangeLog*"
  • End-to-end run against the production spec URLs:
    Output now includes:
    ### Deprecated Actions:
    - [`update_payment_method`](https://apidocs.chargebee.com/docs/api/hosted_pages/update-payment-method) has been deprecated in [`HostedPage`](https://apidocs.chargebee.com/docs/api/hosted_pages).
    
    and the equivalent [list]Endpoint ... has been deprecated.[] line in the CHANGELOG_DOCS output.
  • Reviewer: spot-check a release diff with a known deprecated attribute / parameter to confirm wording and link anchors.

Made with Cursor

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-io

snyk-io Bot commented Jun 15, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@hivel-marco hivel-marco Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 OpenAPI deprecated flag on resources.
  • Enhances ChangeLogDocsGenerator and ChangeLogGenerator to:
    • 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, and ChangeLogSchema with new categories for deprecated resources, actions, attributes, and parameters, and integrates them into collection/partition logic.
  • Updates LocalDocsAvailabilityChecker to 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 deprecated flag 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.

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.

2 participants