forked from loafle/openapi-generator-original
[Rust] set supportAsync to true as the default (#6480)
* set supportAsync to true * set reqwest as the default lib
This commit is contained in:
@@ -40,7 +40,7 @@ for spec_path in \
|
||||
--input-spec $spec_path
|
||||
--generator-name rust
|
||||
--output samples/client/petstore/rust/$library/$spec
|
||||
--additional-properties packageName=${spec}-${library}
|
||||
--additional-properties packageName=${spec}-${library},supportAsync=false
|
||||
--library=$library $@"
|
||||
java ${JAVA_OPTS} -jar ${executable} ${args} || exit 1
|
||||
done
|
||||
|
||||
@@ -6,10 +6,10 @@ sidebar_label: rust
|
||||
| Option | Description | Values | Default |
|
||||
| ------ | ----------- | ------ | ------- |
|
||||
|hideGenerationTimestamp|Hides the generation timestamp when files are generated.| |true|
|
||||
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|hyper|
|
||||
|library|library template (sub-template) to use.|<dl><dt>**hyper**</dt><dd>HTTP client: Hyper.</dd><dt>**reqwest**</dt><dd>HTTP client: Reqwest.</dd></dl>|reqwest|
|
||||
|packageName|Rust package name (convention: lowercase).| |openapi|
|
||||
|packageVersion|Rust package version.| |1.0.0|
|
||||
|supportAsync|If set, generate async function call instead| |false|
|
||||
|supportAsync|If set, generate async function call instead. This option is for 'reqwest' library only| |true|
|
||||
|useSingleRequestParameter|Setting this property to true will generate functions with a single argument containing all API endpoint parameters instead of one argument per parameter.| |false|
|
||||
|
||||
## IMPORT MAPPING
|
||||
|
||||
+6
-6
@@ -39,7 +39,7 @@ import static org.openapitools.codegen.utils.StringUtils.underscore;
|
||||
public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(RustClientCodegen.class);
|
||||
private boolean useSingleRequestParameter = false;
|
||||
private boolean supportAsync = false;
|
||||
private boolean supportAsync = true;
|
||||
|
||||
public static final String PACKAGE_NAME = "packageName";
|
||||
public static final String PACKAGE_VERSION = "packageVersion";
|
||||
@@ -173,18 +173,18 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
cliOptions.add(new CliOption(CodegenConstants.USE_SINGLE_REQUEST_PARAMETER, CodegenConstants.USE_SINGLE_REQUEST_PARAMETER_DESC, SchemaTypeUtil.BOOLEAN_TYPE)
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
cliOptions.add(new CliOption(SUPPORT_ASYNC, "If set, generate async function call instead", SchemaTypeUtil.BOOLEAN_TYPE)
|
||||
.defaultValue(Boolean.FALSE.toString()));
|
||||
cliOptions.add(new CliOption(SUPPORT_ASYNC, "If set, generate async function call instead. This option is for 'reqwest' library only", SchemaTypeUtil.BOOLEAN_TYPE)
|
||||
.defaultValue(Boolean.TRUE.toString()));
|
||||
|
||||
supportedLibraries.put(HYPER_LIBRARY, "HTTP client: Hyper.");
|
||||
supportedLibraries.put(REQWEST_LIBRARY, "HTTP client: Reqwest.");
|
||||
|
||||
CliOption libraryOption = new CliOption(CodegenConstants.LIBRARY, "library template (sub-template) to use.");
|
||||
libraryOption.setEnum(supportedLibraries);
|
||||
// set hyper as the default
|
||||
libraryOption.setDefault(HYPER_LIBRARY);
|
||||
// set reqwest as the default
|
||||
libraryOption.setDefault(REQWEST_LIBRARY);
|
||||
cliOptions.add(libraryOption);
|
||||
setLibrary(HYPER_LIBRARY);
|
||||
setLibrary(REQWEST_LIBRARY);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user