title: How to use configuration file (openapitools.json) with @openapitools/openapi-generator-cli?
body: <p>I use <a href="https://www.npmjs.com/package/@openapitools/openapi-generator-cli" rel="noreferrer">@openapitools/openapi-generator-cli</a>(v2.1.7) to generate the API library on client side.</p>
  <p>It works pretty well, except I am not able to format the code generated as I want.</p>
  <p>I just noticed there is a new option that allows to configure the spaces as mentioned in the example (<strong>&quot;spaces&quot;: 2</strong>):</p>
  <pre><code>{
    &quot;$schema&quot;: &quot;node_modules/@openapitools/openapi-generator-cli/config.schema.json&quot;,
    &quot;spaces&quot;: 2,
    &quot;generator-cli&quot;: {
      &quot;version&quot;: &quot;4.3.1&quot;,
      &quot;storageDir&quot;: &quot;~/my/custom/storage/dir&quot;, // optional
      &quot;generators&quot;: { // optional
        &quot;v2.0&quot;: { // any name you like (just printed to the console log) 
          &quot;generatorName&quot;: &quot;typescript-angular&quot;,
          &quot;output&quot;: &quot;#{cwd}/output/v2.0/#{ext}/#{name}&quot;,
          &quot;glob&quot;: &quot;examples/v2.0/{json,yaml}/*.{json,yaml}&quot;,
          &quot;additionalProperties&quot;: {
            &quot;ngVersion&quot;: &quot;6.1.7&quot;,
            &quot;npmName&quot;: &quot;restClient&quot;,
            &quot;supportsES6&quot;: &quot;true&quot;,
            &quot;npmVersion&quot;: &quot;6.9.0&quot;,
            &quot;withInterfaces&quot;: true
          }
        },
        &quot;v3.0&quot;: { // any name you like (just printed to the console log) 
          &quot;generatorName&quot;: &quot;typescript-fetch&quot;,
          &quot;output&quot;: &quot;#{cwd}/output/v3.0/#{ext}/#{name}&quot;,
          &quot;glob&quot;: &quot;examples/v3.0/petstore.{json,yaml}&quot;
        }
      }
    }
  }
  </code></pre>
  <p>This sounds great!</p>
  <p>The problem is that I am not able to use the configuration file as specified in the <a href="https://www.npmjs.com/package/@openapitools/openapi-generator-cli" rel="noreferrer">official page</a>:</p>
  <blockquote>
  <p>If openapi-generator-cli generate is called without further arguments, then the configuration is automatically used to generate your code.</p>
  </blockquote>
  <p>When I do that:</p>
  <pre><code>openapi-generator-cli generate
  </code></pre>
  <p>I keep stuck with an error:</p>
  <blockquote>
  <p>[error] Required option '-i' is missing</p>
  </blockquote>
  <p>And if I add the -i parameter, for example:</p>
  <pre><code>openapi-generator-cli generate -i http://localhost:8081/v2/api-docs
  </code></pre>
  <p>Then the &quot;openapitools.json&quot; file is ignored and overwritten by the default configuration:</p>
  <pre><code>{
    &quot;$schema&quot;: &quot;node_modules/@openapitools/openapi-generator-cli/config.schema.json&quot;,
    &quot;spaces&quot;: 2,
    &quot;generator-cli&quot;: {
      &quot;version&quot;: &quot;4.3.1&quot;
    }
  }
  </code></pre>
  <p>I also tried to do it the way I've used to do it up to now plus adding the parameter &quot;-spaces=2&quot;:</p>
  <pre><code>openapi-generator-cli generate -i http://localhost:8081/v2/api-docs -g typescript-angular -o src/app/tools/openapi -spaces=2
  </code></pre>
  <p>But again it didn't work, plus I have now a useless file (openapitools.json) annoying my obsessive-compulsive disorder!</p>
  <p>For info, my npm version (npm -v) is:</p>
  <blockquote>
  <p>6.14.8</p>
  </blockquote>
  <p>And I am using the current last Angular version:</p>
  <blockquote>
  <p>11.0.0</p>
  </blockquote>