Skip to content

Commit f73ea73

Browse files
author
Goopher Maijenburg
committed
Add package version for python fastapi to be inline with openapi generator docs
1 parent 45e4fa1 commit f73ea73

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/PythonFastAPIServerCodegen.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public PythonFastAPIServerCodegen() {
110110
additionalProperties.put("baseSuffix", BASE_CLASS_SUFFIX);
111111
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, DEFAULT_SOURCE_FOLDER);
112112
additionalProperties.put(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME);
113+
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, DEFAULT_PACKAGE_VERSION);
113114
additionalProperties.put(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE, DEFAULT_IMPL_FOLDER);
114115

115116
languageSpecificPrimitives.add("List");
@@ -148,6 +149,10 @@ public void processOpts() {
148149
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
149150
}
150151

152+
if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
153+
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
154+
}
155+
151156
if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
152157
this.sourceFolder = ((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
153158
}

modules/openapi-generator/src/main/resources/python-fastapi/setup_cfg.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = {{packageName}}
3-
version = {{appVersion}}
3+
version = {{packageVersion}}
44
description = {{appDescription}}
55
long_description = file: README.md
66
keywords = OpenAPI {{appName}}

0 commit comments

Comments
 (0)