diff --git a/docs/generators/typescript-angular.md b/docs/generators/typescript-angular.md index 66097fbbedd..bc3c3de8e70 100644 --- a/docs/generators/typescript-angular.md +++ b/docs/generators/typescript-angular.md @@ -262,11 +262,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-aurelia.md b/docs/generators/typescript-aurelia.md index ec25974af54..2c4e2b2c98f 100644 --- a/docs/generators/typescript-aurelia.md +++ b/docs/generators/typescript-aurelia.md @@ -247,7 +247,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl | Name | Supported | Defined By | | ---- | --------- | ---------- | |BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 |BearerToken|✗|OAS3 |OAuth2_Implicit|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-axios.md b/docs/generators/typescript-axios.md index 17dde5dbe4d..bc112df9a4f 100644 --- a/docs/generators/typescript-axios.md +++ b/docs/generators/typescript-axios.md @@ -255,11 +255,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-fetch.md b/docs/generators/typescript-fetch.md index 6bca61e9a1d..3eb9ff97590 100644 --- a/docs/generators/typescript-fetch.md +++ b/docs/generators/typescript-fetch.md @@ -280,11 +280,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-inversify.md b/docs/generators/typescript-inversify.md index 0d52133cc0e..32a157dae46 100644 --- a/docs/generators/typescript-inversify.md +++ b/docs/generators/typescript-inversify.md @@ -253,11 +253,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 |BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-jquery.md b/docs/generators/typescript-jquery.md index 7261b691947..3f8fb83af49 100644 --- a/docs/generators/typescript-jquery.md +++ b/docs/generators/typescript-jquery.md @@ -248,11 +248,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 |BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-nestjs.md b/docs/generators/typescript-nestjs.md index 2a1650400e1..e0719cec1a1 100644 --- a/docs/generators/typescript-nestjs.md +++ b/docs/generators/typescript-nestjs.md @@ -257,11 +257,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 |BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-node.md b/docs/generators/typescript-node.md index 22775a38af7..aee8c1520e0 100644 --- a/docs/generators/typescript-node.md +++ b/docs/generators/typescript-node.md @@ -251,11 +251,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-redux-query.md b/docs/generators/typescript-redux-query.md index 02212833355..52d5a608296 100644 --- a/docs/generators/typescript-redux-query.md +++ b/docs/generators/typescript-redux-query.md @@ -272,11 +272,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript-rxjs.md b/docs/generators/typescript-rxjs.md index 1a3425d45f3..4e1879ef7fd 100644 --- a/docs/generators/typescript-rxjs.md +++ b/docs/generators/typescript-rxjs.md @@ -265,11 +265,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 |BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/docs/generators/typescript.md b/docs/generators/typescript.md index be2808f081e..54f93296555 100644 --- a/docs/generators/typescript.md +++ b/docs/generators/typescript.md @@ -256,11 +256,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl ### Security Feature | Name | Supported | Defined By | | ---- | --------- | ---------- | -|BasicAuth|✗|OAS2,OAS3 -|ApiKey|✗|OAS2,OAS3 +|BasicAuth|✓|OAS2,OAS3 +|ApiKey|✓|OAS2,OAS3 |OpenIDConnect|✗|OAS3 -|BearerToken|✗|OAS3 -|OAuth2_Implicit|✗|OAS2,OAS3 +|BearerToken|✓|OAS3 +|OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java index 89ac30bb52d..2feca0467c1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractTypeScriptClientCodegen.java @@ -256,8 +256,10 @@ public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen imp modifyFeatureSet(features -> features .includeDocumentationFeatures(DocumentationFeature.Readme) .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML)) - .securityFeatures(EnumSet.noneOf( - SecurityFeature.class + .securityFeatures(EnumSet.of( + SecurityFeature.ApiKey, + SecurityFeature.BasicAuth, + SecurityFeature.OAuth2_Implicit )) .excludeGlobalFeatures( GlobalFeature.XMLStructureDefinitions, diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java index 7675df8f18c..7987a8ebc37 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java @@ -21,6 +21,7 @@ import io.swagger.v3.oas.models.media.Schema; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; import org.openapitools.codegen.meta.features.GlobalFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -90,6 +91,7 @@ public class TypeScriptAngularClientCodegen extends AbstractTypeScriptClientCode modifyFeatureSet(features -> features .includeDocumentationFeatures(DocumentationFeature.Readme) + .includeSecurityFeatures(SecurityFeature.BearerToken) .includeGlobalFeatures(GlobalFeature.ParameterStyling) ); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java index be3224dbb7f..a5bc76b874d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAureliaClientCodegen.java @@ -18,6 +18,8 @@ package org.openapitools.codegen.languages; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -32,6 +34,10 @@ public class TypeScriptAureliaClientCodegen extends AbstractTypeScriptClientCode public TypeScriptAureliaClientCodegen() { super(); + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .securityFeatures(EnumSet.of(SecurityFeature.ApiKey))); + apiTemplateFiles.put("api.mustache", ".ts"); // clear import mapping (from default generator) as TS does not use it diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java index 77cdf74258d..dc0681955ee 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAxiosClientCodegen.java @@ -23,6 +23,7 @@ import io.swagger.v3.parser.util.SchemaTypeUtil; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -50,7 +51,9 @@ public class TypeScriptAxiosClientCodegen extends AbstractTypeScriptClientCodege public TypeScriptAxiosClientCodegen() { super(); - modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .includeSecurityFeatures(SecurityFeature.BearerToken)); // clear import mapping (from default generator) as TS does not use it // at the moment diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java index 0291ebe253f..54d15e867e5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptClientCodegen.java @@ -29,6 +29,8 @@ import org.openapitools.codegen.CodegenConstants.ENUM_PROPERTY_NAMING_TYPE; import org.openapitools.codegen.CodegenDiscriminator.MappedModel; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -89,6 +91,8 @@ public class TypeScriptClientCodegen extends AbstractTypeScriptClientCodegen imp public TypeScriptClientCodegen() { super(); + modifyFeatureSet(features -> features.includeSecurityFeatures(SecurityFeature.BearerToken)); + this.frameworkToHttpLibMap = new HashMap<>(); this.frameworkToHttpLibMap.put("fetch-api", "isomorphic-fetch"); this.frameworkToHttpLibMap.put("jquery", "jquery"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java index bddc05104be..2892c2ca29f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java @@ -28,6 +28,7 @@ import io.swagger.v3.oas.models.servers.Server; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -80,7 +81,9 @@ public class TypeScriptFetchClientCodegen extends AbstractTypeScriptClientCodege public TypeScriptFetchClientCodegen() { super(); - modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); + modifyFeatureSet(features -> features + .includeDocumentationFeatures(DocumentationFeature.Readme) + .includeSecurityFeatures(SecurityFeature.BearerToken)); // clear import mapping (from default generator) as TS does not use it // at the moment diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java index 953465863c3..60f4c2acea5 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNodeClientCodegen.java @@ -23,6 +23,8 @@ import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.oas.models.responses.ApiResponse; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationMap; @@ -51,6 +53,8 @@ public class TypeScriptNodeClientCodegen extends AbstractTypeScriptClientCodegen public TypeScriptNodeClientCodegen() { super(); + modifyFeatureSet(features -> features.includeSecurityFeatures(SecurityFeature.BearerToken)); + typeMapping.put("file", "RequestFile"); // RequestFile is defined as: `type RequestFile = string | Buffer | ReadStream | RequestDetailedFile;` languageSpecificPrimitives.add("Buffer"); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java index a4c13dbbe02..b8098c5eba1 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptReduxQueryClientCodegen.java @@ -20,6 +20,8 @@ package org.openapitools.codegen.languages; import io.swagger.v3.oas.models.media.Schema; import io.swagger.v3.parser.util.SchemaTypeUtil; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.DocumentationFeature; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.model.ModelMap; import org.openapitools.codegen.model.ModelsMap; import org.openapitools.codegen.model.OperationsMap; @@ -45,6 +47,8 @@ public class TypeScriptReduxQueryClientCodegen extends AbstractTypeScriptClientC public TypeScriptReduxQueryClientCodegen() { super(); + modifyFeatureSet(features -> features.includeSecurityFeatures(SecurityFeature.BearerToken)); + // clear import mapping (from default generator) as TS does not use it // at the moment importMapping.clear();