Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public PythonFastAPIServerCodegen() {
additionalProperties.put("baseSuffix", BASE_CLASS_SUFFIX);
additionalProperties.put(CodegenConstants.SOURCE_FOLDER, DEFAULT_SOURCE_FOLDER);
additionalProperties.put(CodegenConstants.PACKAGE_NAME, DEFAULT_PACKAGE_NAME);
additionalProperties.put(CodegenConstants.PACKAGE_VERSION, DEFAULT_PACKAGE_VERSION);
additionalProperties.put(CodegenConstants.FASTAPI_IMPLEMENTATION_PACKAGE, DEFAULT_IMPL_FOLDER);

languageSpecificPrimitives.add("List");
Expand Down Expand Up @@ -148,6 +149,10 @@ public void processOpts() {
setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME));
}

if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) {
setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about adding a else to set the default of packageVersion to appVersion for backward compatibility?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package version is always set to default "1.0.0" as is in line with the documentation at https://openapi-generator.tech/docs/generators/python-fastapi/

Falling back to appVersion isn't necessary and not in line with other generators as well.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


if (additionalProperties.containsKey(CodegenConstants.SOURCE_FOLDER)) {
this.sourceFolder = ((String) additionalProperties.get(CodegenConstants.SOURCE_FOLDER));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = {{packageName}}
version = {{appVersion}}
version = {{packageVersion}}
description = {{appDescription}}
long_description = file: README.md
keywords = OpenAPI {{appName}}
Expand Down