text: 'use strict';
  
  const OpenAPI = require('../');
  const fetch = require('node-fetch');
  
  const generate = async (input, output) => {
      await OpenAPI.generate({
          input,
          output,
          httpClient: OpenAPI.HttpClient.NODE,
          useOptions: false,
          useUnionTypes: false,
          exportCore: true,
          exportSchemas: true,
          exportModels: true,
          exportServices: true,
          // postfix: 'Api',
          // request: './test/custom/request.ts',
          // serviceOptions: {
          //     staticMethods: false,
          //     serviceImports: `
          //     import {Injectable} from '@angular/core';
          //     import {HttpClient} from '@angular/common/http';
          //     `,
          //     serviceDecorator: `@Injectable()`,
          //     serviceConstructor: `constructor(private http: HttpClient) {}`,
          // },
      });
  };
  
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
  const generateRealWorldSpecs = async () => {
      const response = await fetch('https://api.apis.guru/v2/list.json');
  
      const list = await response.json();
      delete list['api.video'];
      delete list['apideck.com:vault'];
      delete list['amazonaws.com:mediaconvert'];
      delete list['bungie.net'];
      delete list['docusign.net'];
      delete list['googleapis.com:adsense'];
      delete list['googleapis.com:servicebroker'];
      delete list['kubernetes.io'];
      delete list['microsoft.com:graph'];
      delete list['presalytics.io:ooxml'];
      delete list['stripe.com'];
  
      const specs = Object.entries(list).map(([name, api]) => {
          const latestVersion = api.versions[api.preferred];
          return {
              name: name
                  .replace(/^[^a-zA-Z]+/g, '')
                  .replace(/[^\w\-]+/g, '-')
                  .trim()
                  .toLowerCase(),
              url: latestVersion.swaggerYamlUrl || latestVersion.swaggerUrl,
          };
      });
  
      for (let i = 0; i < specs.length; i++) {
          const spec = specs[i];
          await generate(spec.url, `./test/generated/${spec.name}/`);
      }
  };
  
  const main = async () => {
      await generate('./test/spec/v2.json', './test/generated/v2/');
      await generate('./test/spec/v3.json', './test/generated/v3/');
      // await generateRealWorldSpecs();
  };
  
  main();
  