forked from loafle/openapi-generator-original
[Python] add project name to setup.py in python client (#5836)
* add project name to setup.py in python client * update python README to use project name * add cli option project name for python
This commit is contained in:
parent
b61dfefa5b
commit
d6c717263c
@ -96,6 +96,7 @@ public class CodegenConstants {
|
|||||||
public static final String ENSURE_UNIQUE_PARAMS = "ensureUniqueParams";
|
public static final String ENSURE_UNIQUE_PARAMS = "ensureUniqueParams";
|
||||||
public static final String ENSURE_UNIQUE_PARAMS_DESC = "Whether to ensure parameter names are unique in an operation (rename parameters that are not).";
|
public static final String ENSURE_UNIQUE_PARAMS_DESC = "Whether to ensure parameter names are unique in an operation (rename parameters that are not).";
|
||||||
|
|
||||||
|
public static final String PROJECT_NAME = "projectName";
|
||||||
public static final String PACKAGE_NAME = "packageName";
|
public static final String PACKAGE_NAME = "packageName";
|
||||||
public static final String PACKAGE_VERSION = "packageVersion";
|
public static final String PACKAGE_VERSION = "packageVersion";
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,4 @@
|
|||||||
# {{packageName}}
|
# {{{projectName}}}
|
||||||
{{#appDescription}}
|
{{#appDescription}}
|
||||||
{{{appDescription}}}
|
{{{appDescription}}}
|
||||||
{{/appDescription}}
|
{{/appDescription}}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import sys
|
import sys
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
NAME = "{{packageName}}"
|
NAME = "{{{projectName}}}"
|
||||||
VERSION = "{{packageVersion}}"
|
VERSION = "{{packageVersion}}"
|
||||||
{{#apiInfo}}
|
{{#apiInfo}}
|
||||||
{{#apis}}
|
{{#apis}}
|
||||||
|
@ -9,6 +9,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class PythonClientOptionsProvider implements OptionsProvider {
|
public class PythonClientOptionsProvider implements OptionsProvider {
|
||||||
public static final String PACKAGE_NAME_VALUE = "swagger_client_python";
|
public static final String PACKAGE_NAME_VALUE = "swagger_client_python";
|
||||||
|
public static final String PROJECT_NAME_VALUE = "swagger-client-python";
|
||||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||||
public static final String PACKAGE_URL_VALUE = "";
|
public static final String PACKAGE_URL_VALUE = "";
|
||||||
|
|
||||||
@ -22,6 +23,7 @@ public class PythonClientOptionsProvider implements OptionsProvider {
|
|||||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||||
return builder.put(PythonClientCodegen.PACKAGE_URL, PACKAGE_URL_VALUE)
|
return builder.put(PythonClientCodegen.PACKAGE_URL, PACKAGE_URL_VALUE)
|
||||||
.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||||
|
.put(CodegenConstants.PROJECT_NAME, PROJECT_NAME_VALUE)
|
||||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
|
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, "true")
|
||||||
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
|
.put(CodegenConstants.HIDE_GENERATION_TIMESTAMP, "true")
|
||||||
|
@ -28,6 +28,8 @@ public class PythonClientOptionsTest extends AbstractOptionsTest {
|
|||||||
new Expectations(clientCodegen) {{
|
new Expectations(clientCodegen) {{
|
||||||
clientCodegen.setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE);
|
clientCodegen.setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE);
|
||||||
times = 1;
|
times = 1;
|
||||||
|
clientCodegen.setProjectName(PythonClientOptionsProvider.PROJECT_NAME_VALUE);
|
||||||
|
times = 1;
|
||||||
clientCodegen.setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
clientCodegen.setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||||
times = 1;
|
times = 1;
|
||||||
clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE);
|
clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
# petstore_api
|
# petstore-api
|
||||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||||
|
|
||||||
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
This Python package is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
import sys
|
import sys
|
||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
NAME = "petstore_api"
|
NAME = "petstore-api"
|
||||||
VERSION = "1.0.0"
|
VERSION = "1.0.0"
|
||||||
# To install the library, run the following
|
# To install the library, run the following
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user