diff --git a/docs/generators/python-fastapi.md b/docs/generators/python-fastapi.md index ac79f8c9523..6cf1623d23d 100644 --- a/docs/generators/python-fastapi.md +++ b/docs/generators/python-fastapi.md @@ -218,11 +218,11 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ---- | --------- | ---------- | |BasicAuth|✓|OAS2,OAS3 |ApiKey|✓|OAS2,OAS3 -|OpenIDConnect|✓|OAS3 +|OpenIDConnect|✗|OAS3 |BearerToken|✓|OAS3 |OAuth2_Implicit|✓|OAS2,OAS3 |OAuth2_Password|✓|OAS2,OAS3 -|OAuth2_ClientCredentials|✓|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✓|OAS2,OAS3 |SignatureAuth|✗|OAS3 diff --git a/docs/generators/python-flask.md b/docs/generators/python-flask.md index d3dfa095b3f..5f9062ab7ba 100644 --- a/docs/generators/python-flask.md +++ b/docs/generators/python-flask.md @@ -223,12 +223,12 @@ These options may be applied as additional-properties (cli) or configOptions (pl | ---- | --------- | ---------- | |BasicAuth|✓|OAS2,OAS3 |ApiKey|✓|OAS2,OAS3 -|OpenIDConnect|✓|OAS3 +|OpenIDConnect|✗|OAS3 |BearerToken|✓|OAS3 |OAuth2_Implicit|✓|OAS2,OAS3 -|OAuth2_Password|✓|OAS2,OAS3 -|OAuth2_ClientCredentials|✓|OAS2,OAS3 -|OAuth2_AuthorizationCode|✓|OAS2,OAS3 +|OAuth2_Password|✗|OAS2,OAS3 +|OAuth2_ClientCredentials|✗|OAS2,OAS3 +|OAuth2_AuthorizationCode|✗|OAS2,OAS3 |SignatureAuth|✗|OAS3 ### Wire Format Feature diff --git a/docs/generators/python.md b/docs/generators/python.md index d9347534312..0f9b2da65c3 100644 --- a/docs/generators/python.md +++ b/docs/generators/python.md @@ -220,7 +220,7 @@ These options may be applied as additional-properties (cli) or configOptions (pl |OAuth2_Password|✗|OAS2,OAS3 |OAuth2_ClientCredentials|✗|OAS2,OAS3 |OAuth2_AuthorizationCode|✗|OAS2,OAS3 -|SignatureAuth|✗|OAS3 +|SignatureAuth|✓|OAS3 ### Wire Format Feature | Name | Supported | Defined By | diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java index b3141ce9b03..9c8d80f0090 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractPythonCodegen.java @@ -24,6 +24,7 @@ import io.swagger.v3.oas.models.parameters.Parameter; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; +import org.openapitools.codegen.meta.features.SecurityFeature; import org.openapitools.codegen.utils.ModelUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,6 +50,13 @@ public abstract class AbstractPythonCodegen extends DefaultCodegen implements Co public AbstractPythonCodegen() { super(); + modifyFeatureSet(features -> features.securityFeatures(EnumSet.of( + SecurityFeature.BasicAuth, + SecurityFeature.BearerToken, + SecurityFeature.ApiKey, + SecurityFeature.OAuth2_Implicit + ))); + // from https://docs.python.org/3/reference/lexical_analysis.html#keywords setReservedWordsLowerCase( Arrays.asList( diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java index cbba8a4f742..60303f56a8d 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonClientCodegen.java @@ -78,12 +78,7 @@ public class PythonClientCodegen extends AbstractPythonCodegen implements Codege modifyFeatureSet(features -> features .includeDocumentationFeatures(DocumentationFeature.Readme) .wireFormatFeatures(EnumSet.of(WireFormatFeature.JSON, WireFormatFeature.XML, WireFormatFeature.Custom)) - .securityFeatures(EnumSet.of( - SecurityFeature.BasicAuth, - SecurityFeature.BearerToken, - SecurityFeature.ApiKey, - SecurityFeature.OAuth2_Implicit - )) + .includeSecurityFeatures(SecurityFeature.SignatureAuth) .excludeGlobalFeatures( GlobalFeature.XMLStructureDefinitions, GlobalFeature.Callbacks, diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java index b441fd3de15..0e9aa9ad30f 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.StringUtils; import org.openapitools.codegen.*; import org.openapitools.codegen.meta.GeneratorMetadata; import org.openapitools.codegen.meta.Stability; +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; @@ -88,6 +89,11 @@ public class PythonFastAPIServerCodegen extends AbstractPythonCodegen { public PythonFastAPIServerCodegen() { super(); + modifyFeatureSet(features -> features.includeSecurityFeatures( + SecurityFeature.OAuth2_AuthorizationCode, + SecurityFeature.OAuth2_Password + )); + generatorMetadata = GeneratorMetadata.newBuilder(generatorMetadata) .stability(Stability.BETA) .build();