Skip to content

Remove unused private methods and commented-out code - #25602

Open
ChihweiLHBird wants to merge 1 commit into
OpenAPITools:masterfrom
ChihweiLHBird:cleanup/remove-dead-private-methods
Open

ChihweiLHBird wants to merge 1 commit into
OpenAPITools:masterfrom
ChihweiLHBird:cleanup/remove-dead-private-methods

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Removes private methods that nothing calls, plus the constants and commented-out code that only existed for them. Generated output is unchanged.

  • InlineModelResolver: fixStringModel with its helpers schemaIsOfType and schemaContainsExample, and makeSchema (replaced by makeSchemaInComponents in [Inline model resolver] better handling of inline responses and bug fixes #12353; only a commented-out call was left)
  • AbstractApexCodegen: sanitizePackageName, sanitizePath, the commented-out getAccept block and the Guava Strings import
  • AbstractAdaCodegen: isMimetypeOctetStream and APPLICATION_OCTET_STREAM
  • RustServerCodegen, RustServerCodegenDeprecated: isMimetypeOctetStream (and octetMimeType in RustServerCodegen)
  • KotlinServerCodegen: isKtor2 (only isKtor2Or3 is used)
  • CppOatppClientCodegen, CppOatppServerCodegen: postProcessSingleParam

Most were never called since they were added (copied from another generator or migrated from swagger-codegen); the InlineModelResolver and Rust ones lost their last caller in earlier refactors.

CC committee members

cc technical committee members for the touched generators (Apex has none listed):

PR checklist

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    Commit all changed files.
    This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
    These must match the expectations made by your contribution.
    You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example ./bin/generate-samples.sh bin/configs/java*.
    IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Removes private methods, constants, and commented-out code that nothing calls so the dead code no longer looks like it should be used. Generated output is unchanged; most removed methods were never called since they were added, and the InlineModelResolver and Rust ones lost their last caller in earlier refactors.

  • InlineModelResolver: removes fixStringModel and its helpers, makeSchema, and a commented-out call.
  • Apex, Ada, C++ Oat++, Kotlin, Rust, and JavaScript generators: removes unused octet-stream mimetype checks, sanitizers, the Guava import, isKtor2, postProcessSingleParam, and commented-out sanitizePath blocks.

Written for commit 5987ecd. Summary will update on new commits.

View guided diff

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 10 files

View guided diff | Re-trigger cubic

@ChihweiLHBird
ChihweiLHBird force-pushed the cleanup/remove-dead-private-methods branch 6 times, most recently from 9ae4a1c to 6fd16bd Compare November 18, 2026 07:11
@ChihweiLHBird
ChihweiLHBird force-pushed the cleanup/remove-dead-private-methods branch from 6fd16bd to 3fed5f8 Compare November 19, 2026 17:43
@ChihweiLHBird
ChihweiLHBird force-pushed the cleanup/remove-dead-private-methods branch from 3fed5f8 to 5987ecd Compare November 20, 2026 07:56

This branch has not been deployed

No deployments
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.

1 participant