forked from loafle/openapi-generator-original
Merge remote-tracking branch 'origin/master' into 7.0.x
This commit is contained in:
commit
1d2d56ab65
@ -158,7 +158,7 @@ after_success:
|
|||||||
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||||
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
|
if [ "$TRAVIS_BRANCH" = "master" ] && [ -z $TRAVIS_TAG ]; then
|
||||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||||
mvn clean deploy -DskipTests=true -B -U -P release --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
mvn clean deploy --quiet -DskipTests=true -B -U -P release --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||||
pushd .;
|
pushd .;
|
||||||
cd modules/openapi-generator-gradle-plugin;
|
cd modules/openapi-generator-gradle-plugin;
|
||||||
@ -167,7 +167,7 @@ after_success:
|
|||||||
popd;
|
popd;
|
||||||
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
elif [ -z $TRAVIS_TAG ] && [[ "$TRAVIS_BRANCH" =~ ^[0-9]+\.[0-9]+\.x$ ]]; then
|
||||||
echo "Publishing from branch $TRAVIS_BRANCH";
|
echo "Publishing from branch $TRAVIS_BRANCH";
|
||||||
mvn clean deploy --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
mvn clean deploy --quiet --settings CI/settings.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error;
|
||||||
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
echo "Finished mvn clean deploy for $TRAVIS_BRANCH";
|
||||||
pushd .;
|
pushd .;
|
||||||
cd modules/openapi-generator-gradle-plugin;
|
cd modules/openapi-generator-gradle-plugin;
|
||||||
|
@ -290,7 +290,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -247,7 +247,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -258,7 +258,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -305,7 +305,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -258,7 +258,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -204,7 +204,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -259,7 +259,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -151,7 +151,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -203,7 +203,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✗|OAS2,OAS3
|
|OAuth2_Implicit|✗|OAS2,OAS3
|
||||||
|OAuth2_Password|✗|OAS2,OAS3
|
|OAuth2_Password|✗|OAS2,OAS3
|
||||||
|
@ -202,7 +202,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✗|OAS2,OAS3
|
|OAuth2_Implicit|✗|OAS2,OAS3
|
||||||
|OAuth2_Password|✗|OAS2,OAS3
|
|OAuth2_Password|✗|OAS2,OAS3
|
||||||
|
@ -151,7 +151,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -168,7 +168,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -228,7 +228,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -150,7 +150,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -217,7 +217,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -223,7 +223,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -338,7 +338,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -156,7 +156,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -281,7 +281,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl
|
|||||||
| ---- | --------- | ---------- |
|
| ---- | --------- | ---------- |
|
||||||
|BasicAuth|✓|OAS2,OAS3
|
|BasicAuth|✓|OAS2,OAS3
|
||||||
|ApiKey|✓|OAS2,OAS3
|
|ApiKey|✓|OAS2,OAS3
|
||||||
|OpenIDConnect|✗|OAS3
|
|OpenIDConnect|✓|OAS3
|
||||||
|BearerToken|✓|OAS3
|
|BearerToken|✓|OAS3
|
||||||
|OAuth2_Implicit|✓|OAS2,OAS3
|
|OAuth2_Implicit|✓|OAS2,OAS3
|
||||||
|OAuth2_Password|✓|OAS2,OAS3
|
|OAuth2_Password|✓|OAS2,OAS3
|
||||||
|
@ -59,6 +59,7 @@ public class CodegenSecurity {
|
|||||||
filteredSecurity.isBasicBearer = isBasicBearer;
|
filteredSecurity.isBasicBearer = isBasicBearer;
|
||||||
filteredSecurity.isApiKey = isApiKey;
|
filteredSecurity.isApiKey = isApiKey;
|
||||||
filteredSecurity.isOAuth = isOAuth;
|
filteredSecurity.isOAuth = isOAuth;
|
||||||
|
filteredSecurity.isOpenId = isOpenId;
|
||||||
filteredSecurity.keyParamName = keyParamName;
|
filteredSecurity.keyParamName = keyParamName;
|
||||||
filteredSecurity.isCode = isCode;
|
filteredSecurity.isCode = isCode;
|
||||||
filteredSecurity.isImplicit = isImplicit;
|
filteredSecurity.isImplicit = isImplicit;
|
||||||
@ -103,6 +104,7 @@ public class CodegenSecurity {
|
|||||||
Objects.equals(scheme, that.scheme) &&
|
Objects.equals(scheme, that.scheme) &&
|
||||||
Objects.equals(isBasic, that.isBasic) &&
|
Objects.equals(isBasic, that.isBasic) &&
|
||||||
Objects.equals(isOAuth, that.isOAuth) &&
|
Objects.equals(isOAuth, that.isOAuth) &&
|
||||||
|
Objects.equals(isOpenId, that.isOpenId) &&
|
||||||
Objects.equals(isApiKey, that.isApiKey) &&
|
Objects.equals(isApiKey, that.isApiKey) &&
|
||||||
Objects.equals(isBasicBasic, that.isBasicBasic) &&
|
Objects.equals(isBasicBasic, that.isBasicBasic) &&
|
||||||
Objects.equals(isHttpSignature, that.isHttpSignature) &&
|
Objects.equals(isHttpSignature, that.isHttpSignature) &&
|
||||||
@ -128,7 +130,7 @@ public class CodegenSecurity {
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
|
|
||||||
return Objects.hash(name, description, type, scheme, isBasic, isOAuth, isApiKey,
|
return Objects.hash(name, description, type, scheme, isBasic, isOAuth, isOpenId, isApiKey,
|
||||||
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
|
isBasicBasic, isHttpSignature, isBasicBearer, bearerFormat, vendorExtensions,
|
||||||
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
|
keyParamName, isKeyInQuery, isKeyInHeader, isKeyInCookie, flow,
|
||||||
authorizationUrl, tokenUrl, refreshUrl, scopes, isCode, isPassword, isApplication, isImplicit,
|
authorizationUrl, tokenUrl, refreshUrl, scopes, isCode, isPassword, isApplication, isImplicit,
|
||||||
@ -144,6 +146,7 @@ public class CodegenSecurity {
|
|||||||
sb.append(", scheme='").append(scheme).append('\'');
|
sb.append(", scheme='").append(scheme).append('\'');
|
||||||
sb.append(", isBasic=").append(isBasic);
|
sb.append(", isBasic=").append(isBasic);
|
||||||
sb.append(", isOAuth=").append(isOAuth);
|
sb.append(", isOAuth=").append(isOAuth);
|
||||||
|
sb.append(", isOpenIdConnect=").append(isOpenId);
|
||||||
sb.append(", isApiKey=").append(isApiKey);
|
sb.append(", isApiKey=").append(isApiKey);
|
||||||
sb.append(", isBasicBasic=").append(isBasicBasic);
|
sb.append(", isBasicBasic=").append(isBasicBasic);
|
||||||
sb.append(", isHttpSignature=").append(isHttpSignature);
|
sb.append(", isHttpSignature=").append(isHttpSignature);
|
||||||
|
@ -42,7 +42,6 @@ import io.swagger.v3.oas.models.security.SecurityScheme;
|
|||||||
import io.swagger.v3.oas.models.servers.Server;
|
import io.swagger.v3.oas.models.servers.Server;
|
||||||
import io.swagger.v3.oas.models.servers.ServerVariable;
|
import io.swagger.v3.oas.models.servers.ServerVariable;
|
||||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||||
import org.apache.commons.lang3.ObjectUtils;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.apache.commons.text.StringEscapeUtils;
|
import org.apache.commons.text.StringEscapeUtils;
|
||||||
@ -78,24 +77,6 @@ import java.util.regex.Pattern;
|
|||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import io.swagger.v3.core.util.Json;
|
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
|
||||||
import io.swagger.v3.oas.models.Operation;
|
|
||||||
import io.swagger.v3.oas.models.PathItem;
|
|
||||||
import io.swagger.v3.oas.models.callbacks.Callback;
|
|
||||||
import io.swagger.v3.oas.models.examples.Example;
|
|
||||||
import io.swagger.v3.oas.models.headers.Header;
|
|
||||||
import io.swagger.v3.oas.models.media.*;
|
|
||||||
import io.swagger.v3.oas.models.parameters.*;
|
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponse;
|
|
||||||
import io.swagger.v3.oas.models.responses.ApiResponses;
|
|
||||||
import io.swagger.v3.oas.models.security.OAuthFlow;
|
|
||||||
import io.swagger.v3.oas.models.security.OAuthFlows;
|
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
||||||
import io.swagger.v3.oas.models.servers.Server;
|
|
||||||
import io.swagger.v3.oas.models.servers.ServerVariable;
|
|
||||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
|
||||||
|
|
||||||
import static org.openapitools.codegen.CodegenConstants.UNSUPPORTED_V310_SPEC_MSG;
|
import static org.openapitools.codegen.CodegenConstants.UNSUPPORTED_V310_SPEC_MSG;
|
||||||
import static org.openapitools.codegen.utils.OnceLogger.once;
|
import static org.openapitools.codegen.utils.OnceLogger.once;
|
||||||
import static org.openapitools.codegen.utils.StringUtils.*;
|
import static org.openapitools.codegen.utils.StringUtils.*;
|
||||||
@ -148,8 +129,8 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
.includeSecurityFeatures(
|
.includeSecurityFeatures(
|
||||||
SecurityFeature.BasicAuth, SecurityFeature.ApiKey, SecurityFeature.BearerToken,
|
SecurityFeature.BasicAuth, SecurityFeature.ApiKey, SecurityFeature.BearerToken,
|
||||||
SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_Password,
|
SecurityFeature.OAuth2_Implicit, SecurityFeature.OAuth2_Password,
|
||||||
SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_AuthorizationCode
|
SecurityFeature.OAuth2_ClientCredentials, SecurityFeature.OAuth2_AuthorizationCode,
|
||||||
// OpenIDConnect not yet supported
|
SecurityFeature.OpenIDConnect
|
||||||
)
|
)
|
||||||
.includeWireFormatFeatures(
|
.includeWireFormatFeatures(
|
||||||
WireFormatFeature.JSON, WireFormatFeature.XML
|
WireFormatFeature.JSON, WireFormatFeature.XML
|
||||||
@ -5293,7 +5274,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
final SecurityScheme securityScheme = securitySchemeMap.get(key);
|
final SecurityScheme securityScheme = securitySchemeMap.get(key);
|
||||||
if (SecurityScheme.Type.APIKEY.equals(securityScheme.getType())) {
|
if (SecurityScheme.Type.APIKEY.equals(securityScheme.getType())) {
|
||||||
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
||||||
cs.isBasic = cs.isOAuth = false;
|
cs.isBasic = cs.isOAuth = cs.isOpenId = false;
|
||||||
cs.isApiKey = true;
|
cs.isApiKey = true;
|
||||||
cs.keyParamName = securityScheme.getName();
|
cs.keyParamName = securityScheme.getName();
|
||||||
cs.isKeyInHeader = securityScheme.getIn() == SecurityScheme.In.HEADER;
|
cs.isKeyInHeader = securityScheme.getIn() == SecurityScheme.In.HEADER;
|
||||||
@ -5302,7 +5283,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
codegenSecurities.add(cs);
|
codegenSecurities.add(cs);
|
||||||
} else if (SecurityScheme.Type.HTTP.equals(securityScheme.getType())) {
|
} else if (SecurityScheme.Type.HTTP.equals(securityScheme.getType())) {
|
||||||
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
||||||
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isOAuth = false;
|
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isOAuth = cs.isOpenId = false;
|
||||||
cs.isBasic = true;
|
cs.isBasic = true;
|
||||||
if ("basic".equalsIgnoreCase(securityScheme.getScheme())) {
|
if ("basic".equalsIgnoreCase(securityScheme.getScheme())) {
|
||||||
cs.isBasicBasic = true;
|
cs.isBasicBasic = true;
|
||||||
@ -5321,11 +5302,6 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
once(LOGGER).warn("Unknown scheme `{}` found in the HTTP security definition.", securityScheme.getScheme());
|
once(LOGGER).warn("Unknown scheme `{}` found in the HTTP security definition.", securityScheme.getScheme());
|
||||||
}
|
}
|
||||||
codegenSecurities.add(cs);
|
codegenSecurities.add(cs);
|
||||||
} else if (SecurityScheme.Type.OPENIDCONNECT.equals(securityScheme.getType())) {
|
|
||||||
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
|
||||||
cs.isOpenId = true;
|
|
||||||
cs.openIdConnectUrl = securityScheme.getOpenIdConnectUrl();
|
|
||||||
codegenSecurities.add(cs);
|
|
||||||
} else if (SecurityScheme.Type.OAUTH2.equals(securityScheme.getType())) {
|
} else if (SecurityScheme.Type.OAUTH2.equals(securityScheme.getType())) {
|
||||||
final OAuthFlows flows = securityScheme.getFlows();
|
final OAuthFlows flows = securityScheme.getFlows();
|
||||||
boolean isFlowEmpty = true;
|
boolean isFlowEmpty = true;
|
||||||
@ -5368,6 +5344,15 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
if (isFlowEmpty) {
|
if (isFlowEmpty) {
|
||||||
once(LOGGER).error("Invalid flow definition defined in the security scheme: {}", flows);
|
once(LOGGER).error("Invalid flow definition defined in the security scheme: {}", flows);
|
||||||
}
|
}
|
||||||
|
} else if (SecurityScheme.Type.OPENIDCONNECT.equals(securityScheme.getType())) {
|
||||||
|
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
||||||
|
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isBasic = false;
|
||||||
|
cs.isOpenId = true;
|
||||||
|
cs.openIdConnectUrl = securityScheme.getOpenIdConnectUrl();
|
||||||
|
if (securityScheme.getFlows() != null) {
|
||||||
|
setOpenIdConnectInfo(cs, securityScheme.getFlows().getAuthorizationCode());
|
||||||
|
}
|
||||||
|
codegenSecurities.add(cs);
|
||||||
} else {
|
} else {
|
||||||
once(LOGGER).error("Unknown type `{}` found in the security definition `{}`.", securityScheme.getType(), securityScheme.getName());
|
once(LOGGER).error("Unknown type `{}` found in the security definition `{}`.", securityScheme.getType(), securityScheme.getName());
|
||||||
}
|
}
|
||||||
@ -5393,7 +5378,7 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
|
|
||||||
private CodegenSecurity defaultOauthCodegenSecurity(String key, SecurityScheme securityScheme) {
|
private CodegenSecurity defaultOauthCodegenSecurity(String key, SecurityScheme securityScheme) {
|
||||||
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
final CodegenSecurity cs = defaultCodegenSecurity(key, securityScheme);
|
||||||
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isBasic = false;
|
cs.isKeyInHeader = cs.isKeyInQuery = cs.isKeyInCookie = cs.isApiKey = cs.isBasic = cs.isOpenId = false;
|
||||||
cs.isOAuth = true;
|
cs.isOAuth = true;
|
||||||
return cs;
|
return cs;
|
||||||
}
|
}
|
||||||
@ -6618,6 +6603,18 @@ public class DefaultCodegen implements CodegenConfig {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setOpenIdConnectInfo(CodegenSecurity codegenSecurity, OAuthFlow flow) {
|
||||||
|
if (flow.getScopes() != null && !flow.getScopes().isEmpty()) {
|
||||||
|
List<Map<String, Object>> scopes = new ArrayList<>();
|
||||||
|
for (Map.Entry<String, String> scopeEntry : flow.getScopes().entrySet()) {
|
||||||
|
Map<String, Object> scope = new HashMap<>();
|
||||||
|
scope.put("scope", scopeEntry.getKey());
|
||||||
|
scopes.add(scope);
|
||||||
|
}
|
||||||
|
codegenSecurity.scopes = scopes;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void addConsumesInfo(Operation operation, CodegenOperation codegenOperation) {
|
private void addConsumesInfo(Operation operation, CodegenOperation codegenOperation) {
|
||||||
RequestBody requestBody = ModelUtils.getReferencedRequestBody(this.openAPI, operation.getRequestBody());
|
RequestBody requestBody = ModelUtils.getReferencedRequestBody(this.openAPI, operation.getRequestBody());
|
||||||
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) {
|
if (requestBody == null || requestBody.getContent() == null || requestBody.getContent().isEmpty()) {
|
||||||
|
@ -882,6 +882,10 @@ public class DefaultGenerator implements Generator {
|
|||||||
bundle.put("hasOAuthMethods", true);
|
bundle.put("hasOAuthMethods", true);
|
||||||
bundle.put("oauthMethods", ProcessUtils.getOAuthMethods(authMethods));
|
bundle.put("oauthMethods", ProcessUtils.getOAuthMethods(authMethods));
|
||||||
}
|
}
|
||||||
|
if (ProcessUtils.hasOpenIdConnectMethods(authMethods)) {
|
||||||
|
bundle.put("hasOpenIdConnectMethods", true);
|
||||||
|
bundle.put("openIdConnectMethods", ProcessUtils.getOpenIdConnectMethods(authMethods));
|
||||||
|
}
|
||||||
if (ProcessUtils.hasHttpBearerMethods(authMethods)) {
|
if (ProcessUtils.hasHttpBearerMethods(authMethods)) {
|
||||||
bundle.put("hasHttpBearerMethods", true);
|
bundle.put("hasHttpBearerMethods", true);
|
||||||
bundle.put("httpBearerMethods", ProcessUtils.getHttpBearerMethods(authMethods));
|
bundle.put("httpBearerMethods", ProcessUtils.getHttpBearerMethods(authMethods));
|
||||||
@ -1296,7 +1300,7 @@ public class DefaultGenerator implements Generator {
|
|||||||
*/
|
*/
|
||||||
private Set<Map<String, String>> toImportsObjects(Map<String, String> mappedImports) {
|
private Set<Map<String, String>> toImportsObjects(Map<String, String> mappedImports) {
|
||||||
Set<Map<String, String>> result = new TreeSet<>(
|
Set<Map<String, String>> result = new TreeSet<>(
|
||||||
Comparator.comparing(o -> o.get("classname"))
|
Comparator.comparing(o -> o.get("classname"))
|
||||||
);
|
);
|
||||||
|
|
||||||
mappedImports.forEach((key, value) -> {
|
mappedImports.forEach((key, value) -> {
|
||||||
@ -1409,6 +1413,32 @@ public class DefaultGenerator implements Generator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
authMethods.put(key, oauthUpdatedScheme);
|
authMethods.put(key, oauthUpdatedScheme);
|
||||||
|
} else if (securityScheme.getType().equals(SecurityScheme.Type.OPENIDCONNECT)) {
|
||||||
|
// Security scheme only allows to add scope in Flows, so randomly using authorization code flow
|
||||||
|
OAuthFlows openIdConnectUpdatedFlows = new OAuthFlows();
|
||||||
|
OAuthFlow flow = new OAuthFlow();
|
||||||
|
Scopes flowScopes = new Scopes();
|
||||||
|
securities.stream()
|
||||||
|
.map(secReq -> secReq.get(key))
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.flatMap(List::stream)
|
||||||
|
.forEach(value -> flowScopes.put(value, value));
|
||||||
|
flow.scopes(flowScopes);
|
||||||
|
openIdConnectUpdatedFlows.authorizationCode(flow);
|
||||||
|
|
||||||
|
SecurityScheme openIdConnectUpdatedScheme = new SecurityScheme()
|
||||||
|
.type(securityScheme.getType())
|
||||||
|
.description(securityScheme.getDescription())
|
||||||
|
.name(securityScheme.getName())
|
||||||
|
.$ref(securityScheme.get$ref())
|
||||||
|
.in(securityScheme.getIn())
|
||||||
|
.scheme(securityScheme.getScheme())
|
||||||
|
.bearerFormat(securityScheme.getBearerFormat())
|
||||||
|
.openIdConnectUrl(securityScheme.getOpenIdConnectUrl())
|
||||||
|
.extensions(securityScheme.getExtensions())
|
||||||
|
.flows(openIdConnectUpdatedFlows);
|
||||||
|
|
||||||
|
authMethods.put(key, openIdConnectUpdatedScheme);
|
||||||
} else {
|
} else {
|
||||||
authMethods.put(key, securityScheme);
|
authMethods.put(key, securityScheme);
|
||||||
}
|
}
|
||||||
|
@ -241,6 +241,61 @@ public class ProcessUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the specified OAS model has at least one operation with OpenIdConnect authentication.
|
||||||
|
*
|
||||||
|
* @param openAPI An instance of OpenAPI
|
||||||
|
* @return True if at least one operation has OpenIdConnect security scheme defined
|
||||||
|
*/
|
||||||
|
public static boolean hasOpenIdConnectMethods(OpenAPI openAPI) {
|
||||||
|
final Map<String, SecurityScheme> securitySchemes = getSecuritySchemes(openAPI);
|
||||||
|
if (securitySchemes != null) {
|
||||||
|
for (Map.Entry<String, SecurityScheme> scheme : securitySchemes.entrySet()) {
|
||||||
|
if (SecurityScheme.Type.OPENIDCONNECT.equals(scheme.getValue().getType())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of OpenIdConnect Codegen security objects
|
||||||
|
*
|
||||||
|
* @param authMethods List of auth methods.
|
||||||
|
* @return A list of OpenIdConnect Codegen security objects
|
||||||
|
*/
|
||||||
|
public static List<CodegenSecurity> getOpenIdConnectMethods(List<CodegenSecurity> authMethods) {
|
||||||
|
List<CodegenSecurity> oauthMethods = new ArrayList<>();
|
||||||
|
|
||||||
|
for (CodegenSecurity cs : authMethods) {
|
||||||
|
if (Boolean.TRUE.equals(cs.isOpenId)) {
|
||||||
|
oauthMethods.add(cs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return oauthMethods;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a list of OpenIdConnect Codegen security objects
|
||||||
|
*
|
||||||
|
* @param authMethods List of auth methods.
|
||||||
|
* @return A list of OpenIdConnect Codegen security objects
|
||||||
|
*/
|
||||||
|
public static boolean hasOpenIdConnectMethods(List<CodegenSecurity> authMethods) {
|
||||||
|
|
||||||
|
for (CodegenSecurity cs : authMethods) {
|
||||||
|
if (Boolean.TRUE.equals(cs.isOpenId)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if the specified OAS model has at least one operation with HTTP bearer authentication.
|
* Returns true if the specified OAS model has at least one operation with HTTP bearer authentication.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user