Skip to content

Honor --skip-validate-spec=false instead of always disabling spec validation#24161

Open
vasiliy-mikhailov wants to merge 1 commit into
OpenAPITools:masterfrom
vasiliy-mikhailov:fix/skip-validate-spec-honor-false
Open

Honor --skip-validate-spec=false instead of always disabling spec validation#24161
vasiliy-mikhailov wants to merge 1 commit into
OpenAPITools:masterfrom
vasiliy-mikhailov:fix/skip-validate-spec-honor-false

Conversation

@vasiliy-mikhailov

@vasiliy-mikhailov vasiliy-mikhailov commented Jun 29, 2026

Copy link
Copy Markdown

Description

The --skip-validate-spec CLI option always disables spec validation, even when explicitly set to false. In Generate.java, when the option is provided the code unconditionally calls configurator.setValidateSpec(false), ignoring the actual boolean value, so --skip-validate-spec false (validation on) behaves identically to --skip-validate-spec true (validation off).

Fix

Pass the actual value: configurator.setValidateSpec(!skipValidateSpec).

Test (fails before, passes after)

Added GenerateTest#testSkipValidateSpecFalse, which asserts --skip-validate-spec false enables validation, plus testSkipValidateSpecTrue for the documented skip behaviour.

Before the fix:

[ERROR] Tests run: 2, Failures: 1, Errors: 0 -- in org.openapitools.codegen.cmd.GenerateTest
[ERROR] testSkipValidateSpecFalse <<< FAILURE!  (expected setValidateSpec(true), got setValidateSpec(false))

After the fix:

[INFO] Tests run: 40, Failures: 0, Errors: 0, Skipped: 0 -- in org.openapitools.codegen.cmd.GenerateTest
[INFO] BUILD SUCCESS

AI assistance disclosure

This contribution was produced with the help of an AI pipeline. The pipeline processed a large amount of source code to surface suspected bugs, reproduced a subset of them with failing unit tests and generated candidate fixes, and prepared pull requests from the ones that held up. Each PR was then reviewed and verified by a human before being opened: the fix and test were checked by hand and the test was confirmed to fail before the change and pass after.


Summary by cubic

Honor --skip-validate-spec=false in openapi-generator-cli so validation runs when explicitly set to false. The CLI now passes the actual flag value to the configurator (setValidateSpec(!skipValidateSpec)) and includes tests for both true and false cases.

Written for commit 19465fc. Summary will update on new commits.

Review in cubic

…idation

When --skip-validate-spec is provided, Generate unconditionally called
setValidateSpec(false), ignoring the value, so --skip-validate-spec false
behaved like true. Pass the actual flag value via setValidateSpec(!skipValidateSpec).

Signed-off-by: vmihaylov <vasiliy.mikhailov@gmail.com>

@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 2 files

Re-trigger cubic

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