openapi-generator-cli icon indicating copy to clipboard operation
openapi-generator-cli copied to clipboard

Feature/corporate maven repository

Open gonzalad opened this issue 1 year ago • 7 comments

Hello, this PR should make it easier to use the library with a corporate maven repository.

The PR addresses:

  • https://github.com/OpenAPITools/openapi-generator-cli/issues/835).
  • https://github.com/OpenAPITools/openapi-generator-cli/issues/652

@wing328 or @kay-schecker is it possible for you to review this PR please ?

Contents of this PR:

  1. fix NO_PROXY issue
    This is done by removing explicit handling of HTTP_PROXY and HTTPS_PROXY: Axios already handles that (see https://github.com/axios/axios#request-config).
  2. added generator-cli.http.rejectUnauthorized configuration to avoid the error unable to get local issuer certificate.
  3. support using placeholders for environment variables in any configuration value. this will allow to use env vars to set credentials in the queryUrl or downloadUrl: Usage:
    {
      "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
      "spaces": 2,
      "generator-cli": {
        "version": "7.9.0",
        "repository": {
          "downloadUrl": "https://${MVN_USERNAME}:${MVN_PASSWORD}@mynexus.com/repository/maven-proxy-group/${groupId}/${artifactId}/${versionName}/${artifactId}-${versionName}.jar"
        }
      }
    }
    
    
  4. For people using a nexus registry for both npm and maven registry: add support for retrieving authToken in .npmrc and using the npm token to authenticate to the maven repository.
    • the credentials for connecting to maven repository (authToken) are retrieved from .npmrc file (the credentials used is the one matching the url of the maven server).
    • also, if strict-ssl is set to false in npmrc, then certificate verification is disabled Usage:
    {
      "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json",
      "spaces": 2,
      "generator-cli": {
        "version": "7.9.0",
        "repository": {
          "downloadUrl": "https://mynexus.com/repository/maven-proxy-group/${groupId}/${artifactId}/${versionName}/${artifactId}-${versionName}.jar"
        },
        "useNpmrc": true
      }
    }
    
  5. Fix for running unit tests on windows
  6. Activates logging (I had some issues testing the library on a project, and the library didn't output any logs)

gonzalad avatar Oct 16 '24 23:10 gonzalad