Skip to content

[Ballerina OpenAPI] Add deprecation warning for --use-sanitized-oas#1885

Merged
TharmiganK merged 2 commits into
ballerina-platform:masterfrom
sathindudezoysa:fix-use-sanitized-oas-warning
Mar 20, 2026
Merged

[Ballerina OpenAPI] Add deprecation warning for --use-sanitized-oas#1885
TharmiganK merged 2 commits into
ballerina-platform:masterfrom
sathindudezoysa:fix-use-sanitized-oas-warning

Conversation

@sathindudezoysa
Copy link
Copy Markdown
Contributor

@sathindudezoysa sathindudezoysa commented Mar 13, 2026

Purpose

Fixes ballerina-platform/ballerina-library#7537.

Goals

Add a deprecation warning for the --use-sanitized-oas command option to guide users toward using the bal openapi align command moving forward.

Approach

Added a boolean check inside the execute() method of the OpenAPI command class. If the --use-sanitized-oas flag is detected, it prints a deprecation warning to the outStream without interrupting the rest of the command execution.

Release note

Added a deprecation warning to the CLI indicating that the --use-sanitized-oas option will be removed in a future release in favor of bal openapi align.

Documentation

N/A - This is a CLI warning addition. (Note: If the official docs explicitly list this flag, they may need to be updated to reflect the deprecation).

Automation tests

  • Unit tests

    N/A - Simple standard output warning.

  • Integration tests

    N/A

Security checks

Test environment

  • Ubuntu Linux
  • JDK 21

This pull request adds a runtime deprecation warning to the OpenAPI command-line interface. When users invoke the tool with the --use-sanitized-oas option, the command now outputs a warning message informing them that this option is deprecated and will be removed in a future release, while recommending the bal openapi align command as the replacement approach.

The implementation is minimal, adding a conditional check in the execute() method of the OpenApiCmd class. The warning is printed to the output stream without affecting normal command execution, ensuring backward compatibility while guiding users toward the preferred alternative.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 13, 2026

📝 Walkthrough

Walkthrough

Adds a runtime deprecation warning to OpenApiCmd.execute() that alerts users when the --use-sanitized-oas option is provided, recommending they use bal openapi align instead. No functional logic or control-flow modifications are introduced.

Changes

Cohort / File(s) Summary
Deprecation Warning
openapi-cli/src/main/java/io/ballerina/openapi/cmd/OpenApiCmd.java
Added runtime deprecation warning in execute() method when --use-sanitized-oas option is used, directing users to alternative command.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A gentle nudge from Rabbit's den,
Old paths must fade, new ways begin,
"Use align!" the warning cries with glee,
Hoppy hops toward what's meant to be! 🌟

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The pull request title clearly and concisely describes the main change: adding a deprecation warning for the --use-sanitized-oas option in the Ballerina OpenAPI CLI tool.
Description check ✅ Passed Pull request description covers all essential sections from the template with clear purpose, goals, approach, release notes, documentation, security checks, and test environment details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

Migrating from UI to YAML configuration.

Use the @coderabbitai configuration command in a PR comment to get a dump of all your UI settings in YAML format. You can then edit this YAML file and upload it to the root of your repository to configure CodeRabbit programmatically.

@sathindudezoysa
Copy link
Copy Markdown
Contributor Author

@TharmiganK please can you review my pr.

It is about a if condition to warning about there is a new flag when if they use the old one.

Also let me know if I need to add or edit some things in this pr.

Thank you 😊

Copy link
Copy Markdown
Contributor

@TharmiganK TharmiganK left a comment

Choose a reason for hiding this comment

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

LGTM

@sonarqubecloud
Copy link
Copy Markdown

@TharmiganK TharmiganK merged commit dc1b20a into ballerina-platform:master Mar 20, 2026
6 of 7 checks passed
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.

[Ballerina OpenAPI] Add warnings for the --use-sanitized-oas command option to use bal openapi align moving forward

2 participants