{"record":{"id":"9c624b817987d2bd","repo":"OpenAPITools/openapi-generator","slug":"inputspec-inputspecrootdirectory-or-inputspecfil-9c624b","errorCode":null,"errorMessage":"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified","messagePattern":"inputSpec, inputSpecRootDirectory, or inputSpecFiles must be specified","errorType":"exception","errorClass":"MojoExecutionException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java","lineNumber":268,"sourceCode":"      }\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.\");\n      return true;\n    }\n    return false;\n  }\n\n  private Optional<String> mergeInDirectory() throws MojoExecutionException {\n    // Explicit file list takes precedence\n    if (inputSpecFiles != null && !inputSpecFiles.isEmpty()) {\n      if (mergedFileOutputDir == null) {\n        throw new MojoExecutionException(\"mergedFileOutputDir must be set when inputSpecFiles is used\");\n      }\n      MergedSpecBuilder.MergeMode resolvedMergeMode;","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator-maven-plugin/src/main/java/org/openapitools/codegen/plugin/ValidateMojo.java#L250-L286","documentation":"Thrown by ValidateMojo.validateInputSpecInput when none of the spec inputs is configured: the inputSpec array is null/empty/blank-first-element, inputSpecRootDirectory is blank, and inputSpecFiles is null or empty. It is the validate goal's equivalent of the generate goal's first guard and fails before any reading or merging of specs.","triggerScenarios":"Running mvn openapi-generator:validate without <inputSpec> (or -DinputSpec), no inputSpecRootDirectory, and no inputSpecFiles. Note inputSpec is an array here — a single blank first element (empty tag or whitespace property) also counts as missing.","commonSituations":"Adding a validation execution to the POM but forgetting to mirror the spec path from the generate execution; property typo like <input-spec>; CI jobs invoking the validate goal directly with the -D flag dropped.","solutions":["Add <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec> to the validate execution's configuration.","For directory merges use <inputSpecRootDirectory>; for explicit lists use <inputSpecFiles> plus <mergedFileOutputDir>.","If both goals exist in the POM, put shared settings in one <configuration> at plugin level so validate inherits inputSpec from generate."],"exampleFix":"<!-- before -->\n<execution>\n  <id>validate-spec</id>\n  <goals><goal>validate</goal></goals>\n</execution>\n\n<!-- after -->\n<execution>\n  <id>validate-spec</id>\n  <goals><goal>validate</goal></goals>\n  <configuration>\n    <inputSpec>${project.basedir}/src/main/resources/openapi.yaml</inputSpec>\n  </configuration>\n</execution>","handlingStrategy":"validation","validationCode":"# CI: every validate execution must reference a spec input\ngrep -q 'openapi-generator' pom.xml && \\\n  ! grep -Eq '<inputSpec>|<inputSpecRootDirectory>|<inputSpecFiles>' pom.xml && \\\n  { echo 'validate goal has no spec input configured'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Put inputSpec in the plugin-level <configuration> so both generate and validate executions inherit it.","Remember inputSpec is an array on the validate goal; a blank first element counts as missing.","Include the validate execution in local test runs before pushing POM changes."],"tags":["openapi-generator","maven","plugin-config","missing-parameter","spec-validation"],"backgroundTag":"missing-required-config","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}