{"record":{"id":"86e5d3e7076fa823","repo":"OpenAPITools/openapi-generator","slug":"validation-has-error-s-see-above-for-the-details","errorCode":null,"errorMessage":"Validation has error(s). See above for the details.","messagePattern":"Validation has error\\(s\\)\\. See above for the details\\.","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java","lineNumber":256,"sourceCode":"            if (buildContext != null) {\n              buildContext.addMessage(inputSpecFile, 0, 0, e.getMessage(), BuildContext.SEVERITY_WARNING, null);\n            }\n          }\n        }\n      }\n      if (dryRun) {\n        if (hasError || (strictSpec && hasWarning)) {\n          getLog().warn(\"Validation issues detected in dry-run mode. Please review the results.\");\n          getLog().info(\"The build will not fail because dryRun is active.\");\n        }\n        return;\n      }\n\n      if (hasError || (strictSpec && hasWarning)) {\n        throw new Exception();\n      }\n    } catch (Exception e) {\n      throw new MojoExecutionException(\n          \"Validation has error(s). See above for the details.\");\n    } finally {\n      GlobalSettings.log();\n    }\n  }\n\n  private void validateInputSpecInput() throws MojoExecutionException {\n    boolean isInputSpecEmpty = (inputSpec == null || inputSpec.length == 0 || isBlank(inputSpec[0]));\n\n    if (isInputSpecEmpty && isBlank(inputSpecRootDirectory) && (inputSpecFiles == null || inputSpecFiles.isEmpty())) {\n      LOGGER.error(\"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified\");\n      throw new MojoExecutionException(\"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified\");\n    }\n  }\n\n  private boolean shouldWeSkip() {\n    if (Boolean.TRUE.equals(skip) || Boolean.TRUE.equals(skipValidateSpec)) {\n      getLog().info(\"Validation is skipped.\");","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java#L238-L274","documentation":"End-of-goal wrapper in ValidateMojo: when validation reports errors (or warnings while <strictSpec>true</strictSpec>), the mojo throws a bare Exception inside its try block, which the catch converts to MojoExecutionException('Validation has error(s). See above for the details.'). The per-rule findings were already logged above by logInvalid, so the details live in the preceding log output, not in the exception.","triggerScenarios":"Running openapi-generator:validate on a spec that violates rules (invalid $ref, wrong type shapes, missing required fields) with dryRun=false; or a spec with only warnings while strictSpec is true. With <dryRun>true</dryRun> or skip/skipValidateSpec the goal returns without failing.","commonSituations":"Adding spec validation to a CI gate and legacy specs failing on pre-existing issues; strictSpec=true tightening warning handling; upgrading openapi-generator to a version with new/stricter validation rules that now flag previously passing specs.","solutions":["Scroll up in the log: each 'invalid' line names the rule and location — fix those spec issues and rerun.","For warning-only failures under strict mode, either fix the warnings or set <strictSpec>false</strictSpec> if warnings are acceptable.","Use <dryRun>true</dryRun> while triaging to see all issues without failing the build.","Run openapi-generator-cli validate on the same file locally for faster iteration than a full mvn cycle."],"exampleFix":"<!-- before -->\n<configuration>\n  <inputSpec>${project.basedir}/api.yaml</inputSpec>\n  <strictSpec>true</strictSpec>\n</configuration>\n\n<!-- after -->\n<configuration>\n  <inputSpec>${project.basedir}/api.yaml</inputSpec>\n  <strictSpec>false</strictSpec>\n</configuration>","handlingStrategy":"validation","validationCode":"<!-- triage without breaking the build -->\n<configuration>\n  <inputSpec>${project.basedir}/api.yaml</inputSpec>\n  <dryRun>true</dryRun>\n</configuration>","typeGuard":null,"tryCatchPattern":"# CI: validate locally first, print rule details, then decide\nopenapi-generator-cli validate -i api.yaml || {\n  echo 'spec validation failed; fix the rules listed above before pushing'; exit 1;\n}","preventionTips":["Run validation with dryRun=true during development; enable the hard gate only once the spec is clean.","Set strictSpec=false if warnings are acceptable in your pipeline; keep it true only for error-level rules then.","After upgrading openapi-generator, expect new rules: validate on a branch before rolling the version into main CI.","Fix the reported rules rather than suppressing the goal — the log lines above the exception contain the exact locations."],"tags":["openapi-generator","maven","spec-validation","mojo-execution-exception","strict-mode"],"backgroundTag":"schema-validation-failed","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}