Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Merge requests
  • !6480

[Rust] set supportAsync to true as the default

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged William Cheng requested to merge rust-enhance into master 5 years ago
  • Overview 0
  • Commits 2
  • Pipelines 0
  • Changes 3
  • set supportAsync to true as the default

PR checklist

  • Read the contribution guidelines.
  • If contributing template-only or documentation-only changes which will change sample output, build the project before.
  • Run the shell script(s) under ./bin/ (or Windows batch scripts under.\bin\windows) to update Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run ./bin/{LANG}-petstore.sh, ./bin/openapi3/{LANG}-petstore.sh if updating the code or mustache templates for a language ({LANG}) (e.g. php, ruby, python, etc).
  • File the PR against the correct branch: master, 4.3.x, 5.0.x. Default: master.
  • Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
Compare
  • master (base)

and
  • latest version
    26756b66
    2 commits, 2 years ago

3 files
+ 9
- 9

    Preferences

    File browser
    Compare changes
b‎in‎
rust-pet‎store.sh‎ +1 -1
docs/ge‎nerators‎
rus‎t.md‎ +2 -2
modules/…/…/…/…‎/…/…/…/languages‎
RustClientC‎odegen.java‎ +6 -6
bin/rust-petstore.sh
+ 1
- 1
  • View file @ 26756b66

  • Edit in single-file editor

  • Open in Web IDE


@@ -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
docs/generators/rust.md
+ 2
- 2
  • View file @ 26756b66

  • Edit in single-file editor

  • Open in Web IDE


@@ -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
modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java
+ 6
- 6
  • View file @ 26756b66

  • Edit in single-file editor

  • Open in Web IDE


@@ -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
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
3.3.2
3.3.2 (expired)
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
0
0 participants
Reference: OpenAPITools/openapi-generator!1353
Source branch: rust-enhance

Menu

Explore Projects Groups Snippets