[core] Skip unused schema warnings when recommendations are disabled

TA
16h ago
+32-1

Fixes #25232

OpenApiEvaluator added "Unused model" warnings even when recommendations were turned off globally, so validate without --recommend (and the Maven validate goal) still reported them. Every other recommendation already checks isEnableRecommendations() first. This makes the unused schema check do the same.

Added two tests to OpenApiEvaluatorTest: one for recommendations on (warning still shows up) and one for recommendations off (no warning). The second one failed before the change. Ran all the validations.oas tests locally and they pass. No generator output changes, so no samples to regenerate.

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.
  • 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

Fixes #25232. OpenApiEvaluator reported "Unused model" warnings even when recommendations were disabled, so validate without --recommend (and the Maven validate goal) still flagged unused schemas. The unused schema check now requires isEnableRecommendations() first, matching every other recommendation.

  • Adds tests for recommendations enabled and disabled.