From 7ab636d268f52800f0d4a0c4cb34d15414e3d4bf Mon Sep 17 00:00:00 2001 From: Tiffany Marrel Date: Sat, 3 Jun 2023 05:45:27 +0200 Subject: [PATCH] [JavaScript][javascript-flowtyped] fix security features listed in documentation (#15715) --- docs/generators/javascript-flowtyped.md | 6 +++--- .../languages/JavascriptFlowtypedClientCodegen.java | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/generators/javascript-flowtyped.md b/docs/generators/javascript-flowtyped.md index ce03513a801..928c52b92b6 100644 --- a/docs/generators/javascript-flowtyped.md +++ b/docs/generators/javascript-flowtyped.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 +|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/JavascriptFlowtypedClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java index c459232438b..6de5cdeda04 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptFlowtypedClientCodegen.java @@ -23,6 +23,7 @@ import io.swagger.v3.oas.models.media.Schema; 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; @@ -38,7 +39,12 @@ public class JavascriptFlowtypedClientCodegen extends AbstractTypeScriptClientCo public JavascriptFlowtypedClientCodegen() { super(); - modifyFeatureSet(features -> features.includeDocumentationFeatures(DocumentationFeature.Readme)); + modifyFeatureSet(features -> features + .securityFeatures(EnumSet.of( + SecurityFeature.OAuth2_Implicit, + SecurityFeature.BasicAuth, + SecurityFeature.ApiKey)) + .includeDocumentationFeatures(DocumentationFeature.Readme)); // clear import mapping (from default generator) as TS does not use it // at the moment