diff --git a/bin/openapi3/rust-petstore.sh b/bin/openapi3/rust-petstore.sh new file mode 100755 index 00000000000..9563fde8464 --- /dev/null +++ b/bin/openapi3/rust-petstore.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +SCRIPT="$0" +echo "# START SCRIPT: $SCRIPT" + +while [ -h "$SCRIPT" ] ; do + ls=$(ls -ld "$SCRIPT") + link=$(expr "$ls" : '.*-> \(.*\)$') + if expr "$link" : '/.*' > /dev/null; then + SCRIPT="$link" + else + SCRIPT=$(dirname "$SCRIPT")/"$link" + fi +done + +if [ ! -d "${APP_DIR}" ]; then + APP_DIR=$(dirname "$SCRIPT")/.. + APP_DIR=$(cd "${APP_DIR}"; pwd) +fi + +executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar" + +if [ ! -f "$executable" ] +then + mvn clean package +fi + +# if you've executed sbt assembly previously it will use that instead. +export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" +ags="generate -t modules/openapi-generator/src/main/resources/rust -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l rust -o samples/client/petstore/rust -DpackageName=petstore_client $@" + +java ${JAVA_OPTS} -jar ${executable} ${ags} diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java index 0d079dff629..9871eb9bb2a 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/RustClientCodegen.java @@ -46,7 +46,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { protected String apiDocPath = "docs/"; protected String modelDocPath = "docs/"; protected String apiFolder = "src/apis"; - protected String modelFolder= "src/models"; + protected String modelFolder = "src/models"; public CodegenType getTag() { return CodegenType.CLIENT; @@ -75,34 +75,34 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { embeddedTemplateDir = templateDir = "rust"; setReservedWordsLowerCase( - Arrays.asList( - "abstract", "alignof", "as", "become", "box", - "break", "const", "continue", "crate", "do", - "else", "enum", "extern", "false", "final", - "fn", "for", "if", "impl", "in", - "let", "loop", "macro", "match", "mod", - "move", "mut", "offsetof", "override", "priv", - "proc", "pub", "pure", "ref", "return", - "Self", "self", "sizeof", "static", "struct", - "super", "trait", "true", "type", "typeof", - "unsafe", "unsized", "use", "virtual", "where", - "while", "yield" - ) + Arrays.asList( + "abstract", "alignof", "as", "become", "box", + "break", "const", "continue", "crate", "do", + "else", "enum", "extern", "false", "final", + "fn", "for", "if", "impl", "in", + "let", "loop", "macro", "match", "mod", + "move", "mut", "offsetof", "override", "priv", + "proc", "pub", "pure", "ref", "return", + "Self", "self", "sizeof", "static", "struct", + "super", "trait", "true", "type", "typeof", + "unsafe", "unsized", "use", "virtual", "where", + "while", "yield" + ) ); defaultIncludes = new HashSet( Arrays.asList( - "map", - "array") - ); + "map", + "array") + ); languageSpecificPrimitives = new HashSet( - Arrays.asList( - "i8", "i16", "i32", "i64", - "u8", "u16", "u32", "u64", - "f32", "f64", - "char", "bool", "String", "Vec", "File") - ); + Arrays.asList( + "i8", "i16", "i32", "i64", + "u8", "u16", "u32", "u64", + "f32", "f64", + "char", "bool", "String", "Vec", "File") + ); instantiationTypes.clear(); /*instantiationTypes.put("array", "GoArray"); @@ -121,8 +121,8 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { typeMapping.put("DateTime", "String"); typeMapping.put("password", "String"); // TODO(farcaller): map file - typeMapping.put("file", "File"); - typeMapping.put("binary", "Vec"); + typeMapping.put("file", "::models::File"); + typeMapping.put("binary", "::models::File"); typeMapping.put("ByteArray", "String"); typeMapping.put("object", "Value"); @@ -145,15 +145,13 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { if (additionalProperties.containsKey(CodegenConstants.PACKAGE_NAME)) { setPackageName((String) additionalProperties.get(CodegenConstants.PACKAGE_NAME)); - } - else { + } else { setPackageName("swagger"); } if (additionalProperties.containsKey(CodegenConstants.PACKAGE_VERSION)) { setPackageVersion((String) additionalProperties.get(CodegenConstants.PACKAGE_VERSION)); - } - else { + } else { setPackageVersion("1.0.0"); } @@ -180,8 +178,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { } @Override - public String escapeReservedWord(String name) - { + public String escapeReservedWord(String name) { if (this.reservedWordsMappings().containsKey(name)) { return this.reservedWordsMappings().get(name); } @@ -294,8 +291,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { ArraySchema ap = (ArraySchema) p; Schema inner = ap.getItems(); return "Vec<" + getTypeDeclaration(inner) + ">"; - } - else if (ModelUtils.isMapSchema(p)) { + } else if (ModelUtils.isMapSchema(p)) { Schema inner = (Schema) p.getAdditionalProperties(); return "::std::collections::HashMap"; } @@ -324,12 +320,11 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { public String getSchemaType(Schema p) { String schemaType = super.getSchemaType(p); String type = null; - if(typeMapping.containsKey(schemaType)) { + if (typeMapping.containsKey(schemaType)) { type = typeMapping.get(schemaType); - if(languageSpecificPrimitives.contains(type)) + if (languageSpecificPrimitives.contains(type)) return (type); - } - else + } else type = schemaType; return type; } @@ -413,7 +408,7 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { @Override protected boolean needToImport(String type) { return !defaultIncludes.contains(type) - && !languageSpecificPrimitives.contains(type); + && !languageSpecificPrimitives.contains(type); } public void setPackageName(String packageName) { @@ -495,4 +490,13 @@ public class RustClientCodegen extends DefaultCodegen implements CodegenConfig { return enumName; } } + + @Override + public String toDefaultValue(Schema p) { + if (p.getDefault() != null) { + return p.getDefault().toString(); + } else { + return null; + } + } } diff --git a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache index 70d0b96ce86..29eb3c2e5ec 100644 --- a/modules/openapi-generator/src/main/resources/rust/api_doc.mustache +++ b/modules/openapi-generator/src/main/resources/rust/api_doc.mustache @@ -21,7 +21,7 @@ Method | HTTP request | Description Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{#authMethods}} **ctx** | **context.Context** | context containing the authentication | nil if no authentication{{/authMethods}}{{/-last}}{{/allParams}}{{#allParams}}{{#required}} - **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} + **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/required}}{{/allParams}}{{#hasOptionalParams}} **optional** | **map[string]interface{}** | optional parameters | nil if no parameters ### Optional Parameters @@ -29,7 +29,7 @@ Optional parameters are passed through a map[string]interface{}. {{#allParams}}{{#-last}} Name | Type | Description | Notes ------------- | ------------- | ------------- | -------------{{/-last}}{{/allParams}}{{#allParams}} - **{{paramName}}** | {{#isFile}}**{{dataType}}**{{/isFile}}{{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}{{^isFile}}[**{{dataType}}**]({{baseType}}.md){{/isFile}}{{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}} + **{{paramName}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{baseType}}.md){{/isPrimitiveType}}| {{description}} | {{#defaultValue}}[default to {{defaultValue}}]{{/defaultValue}}{{/allParams}}{{/hasOptionalParams}} ### Return type diff --git a/samples/client/petstore-security-test/swift/.openapi-generator/VERSION b/samples/client/petstore-security-test/swift/.openapi-generator/VERSION index 855ff9501eb..096bf47efe3 100644 --- a/samples/client/petstore-security-test/swift/.openapi-generator/VERSION +++ b/samples/client/petstore-security-test/swift/.openapi-generator/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust/.openapi-generator/VERSION b/samples/client/petstore/rust/.openapi-generator/VERSION index 855ff9501eb..096bf47efe3 100644 --- a/samples/client/petstore/rust/.openapi-generator/VERSION +++ b/samples/client/petstore/rust/.openapi-generator/VERSION @@ -1 +1 @@ -2.4.0-SNAPSHOT \ No newline at end of file +3.0.0-SNAPSHOT \ No newline at end of file diff --git a/samples/client/petstore/rust/README.md b/samples/client/petstore/rust/README.md index d0801d6f9ee..60d2999dcc9 100644 --- a/samples/client/petstore/rust/README.md +++ b/samples/client/petstore/rust/README.md @@ -7,7 +7,7 @@ This API client was generated by the [swagger-codegen](https://github.com/swagge - API version: 1.0.0 - Package version: 1.0.0 -- Build package: io.swagger.codegen.languages.RustClientCodegen +- Build package: org.openapitools.codegen.languages.RustClientCodegen ## Installation Put the package under your project folder and add the following in import: diff --git a/samples/client/petstore/rust/docs/ApiResponse.md b/samples/client/petstore/rust/docs/ApiResponse.md index a34664707bd..3af9a16ab36 100644 --- a/samples/client/petstore/rust/docs/ApiResponse.md +++ b/samples/client/petstore/rust/docs/ApiResponse.md @@ -3,9 +3,9 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **i32** | | [optional] [default to null] -**_type** | **String** | | [optional] [default to null] -**message** | **String** | | [optional] [default to null] +**code** | **i32** | | [optional] +**_type** | **String** | | [optional] +**message** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/Category.md b/samples/client/petstore/rust/docs/Category.md index 6481bb566cd..39aaee2b052 100644 --- a/samples/client/petstore/rust/docs/Category.md +++ b/samples/client/petstore/rust/docs/Category.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **i64** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **i64** | | [optional] +**name** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/Order.md b/samples/client/petstore/rust/docs/Order.md index 8a91ed5952a..f350a8b5b4e 100644 --- a/samples/client/petstore/rust/docs/Order.md +++ b/samples/client/petstore/rust/docs/Order.md @@ -3,12 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **i64** | | [optional] [default to null] -**pet_id** | **i64** | | [optional] [default to null] -**quantity** | **i32** | | [optional] [default to null] -**ship_date** | **String** | | [optional] [default to null] -**status** | **String** | Order Status | [optional] [default to null] -**complete** | **bool** | | [optional] [default to null] +**id** | **i64** | | [optional] +**pet_id** | **i64** | | [optional] +**quantity** | **i32** | | [optional] +**ship_date** | **String** | | [optional] +**status** | **String** | Order Status | [optional] +**complete** | **bool** | | [optional] [default to false] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/Pet.md b/samples/client/petstore/rust/docs/Pet.md index ab2bef92432..097c4390288 100644 --- a/samples/client/petstore/rust/docs/Pet.md +++ b/samples/client/petstore/rust/docs/Pet.md @@ -3,12 +3,12 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **i64** | | [optional] [default to null] -**category** | [***::models::Category**](Category.md) | | [optional] [default to null] -**name** | **String** | | [default to null] -**photo_urls** | **Vec** | | [default to null] -**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional] [default to null] -**status** | **String** | pet status in the store | [optional] [default to null] +**id** | **i64** | | [optional] +**category** | [***::models::Category**](Category.md) | | [optional] +**name** | **String** | | +**photo_urls** | **Vec** | | +**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional] +**status** | **String** | pet status in the store | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/PetApi.md b/samples/client/petstore/rust/docs/PetApi.md index c225d46d739..716a3c04d0a 100644 --- a/samples/client/petstore/rust/docs/PetApi.md +++ b/samples/client/petstore/rust/docs/PetApi.md @@ -15,17 +15,15 @@ Method | HTTP request | Description # **add_pet** -> add_pet(ctx, body) +> add_pet(ctx, pet) Add a new pet to the store - - ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -38,7 +36,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -46,8 +44,6 @@ Name | Type | Description | Notes > delete_pet(ctx, pet_id, optional) Deletes a pet - - ### Required Parameters Name | Type | Description | Notes @@ -75,7 +71,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -164,17 +160,15 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_pet** -> update_pet(ctx, body) +> update_pet(ctx, pet) Update an existing pet - - ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **ctx** | **context.Context** | context containing the authentication | nil if no authentication - **body** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | + **pet** | [**Pet**](Pet.md)| Pet object that needs to be added to the store | ### Return type @@ -187,7 +181,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/json, application/xml - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -195,8 +189,6 @@ Name | Type | Description | Notes > update_pet_with_form(ctx, pet_id, optional) Updates a pet in the store with form data - - ### Required Parameters Name | Type | Description | Notes @@ -225,7 +217,7 @@ Name | Type | Description | Notes ### HTTP request headers - **Content-Type**: application/x-www-form-urlencoded - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -233,8 +225,6 @@ Name | Type | Description | Notes > ::models::ApiResponse upload_file(ctx, pet_id, optional) uploads an image - - ### Required Parameters Name | Type | Description | Notes @@ -250,7 +240,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **pet_id** | **i64**| ID of pet to update | **additional_metadata** | **String**| Additional data to pass to server | - **file** | **File**| file to upload | + **file** | **::models::File**| file to upload | ### Return type diff --git a/samples/client/petstore/rust/docs/StoreApi.md b/samples/client/petstore/rust/docs/StoreApi.md index 7da85fb6470..2be7ed673a2 100644 --- a/samples/client/petstore/rust/docs/StoreApi.md +++ b/samples/client/petstore/rust/docs/StoreApi.md @@ -33,7 +33,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -89,16 +89,14 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **place_order** -> ::models::Order place_order(body) +> ::models::Order place_order(order) Place an order for a pet - - ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Order**](Order.md)| order placed for purchasing the pet | + **order** | [**Order**](Order.md)| order placed for purchasing the pet | ### Return type @@ -110,7 +108,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/json - **Accept**: application/xml, application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/Tag.md b/samples/client/petstore/rust/docs/Tag.md index 9c69cde1e03..d1118479b90 100644 --- a/samples/client/petstore/rust/docs/Tag.md +++ b/samples/client/petstore/rust/docs/Tag.md @@ -3,8 +3,8 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **i64** | | [optional] [default to null] -**name** | **String** | | [optional] [default to null] +**id** | **i64** | | [optional] +**name** | **String** | | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/User.md b/samples/client/petstore/rust/docs/User.md index d9b1f2a95b8..33aa9693902 100644 --- a/samples/client/petstore/rust/docs/User.md +++ b/samples/client/petstore/rust/docs/User.md @@ -3,14 +3,14 @@ ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **i64** | | [optional] [default to null] -**username** | **String** | | [optional] [default to null] -**first_name** | **String** | | [optional] [default to null] -**last_name** | **String** | | [optional] [default to null] -**email** | **String** | | [optional] [default to null] -**password** | **String** | | [optional] [default to null] -**phone** | **String** | | [optional] [default to null] -**user_status** | **i32** | User Status | [optional] [default to null] +**id** | **i64** | | [optional] +**username** | **String** | | [optional] +**first_name** | **String** | | [optional] +**last_name** | **String** | | [optional] +**email** | **String** | | [optional] +**password** | **String** | | [optional] +**phone** | **String** | | [optional] +**user_status** | **i32** | User Status | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/docs/UserApi.md b/samples/client/petstore/rust/docs/UserApi.md index 6ccc9b08f36..ff6c3a7d408 100644 --- a/samples/client/petstore/rust/docs/UserApi.md +++ b/samples/client/petstore/rust/docs/UserApi.md @@ -15,7 +15,7 @@ Method | HTTP request | Description # **create_user** -> create_user(body) +> create_user(user) Create user This can only be done by the logged in user. @@ -24,7 +24,7 @@ This can only be done by the logged in user. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**User**](User.md)| Created user object | + **user** | [**User**](User.md)| Created user object | ### Return type @@ -36,22 +36,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_users_with_array_input** -> create_users_with_array_input(body) +> create_users_with_array_input(user) Creates list of users with given input array - - ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](User.md)| List of user object | + **user** | [**Vec<::models::User>**](array.md)| List of user object | ### Return type @@ -63,22 +61,20 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **create_users_with_list_input** -> create_users_with_list_input(body) +> create_users_with_list_input(user) Creates list of users with given input array - - ### Required Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **body** | [**Vec<::models::User>**](User.md)| List of user object | + **user** | [**Vec<::models::User>**](array.md)| List of user object | ### Return type @@ -90,8 +86,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -118,7 +114,7 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) @@ -126,8 +122,6 @@ No authorization required > ::models::User get_user_by_name(username) Get user by user name - - ### Required Parameters Name | Type | Description | Notes @@ -153,8 +147,6 @@ No authorization required > String login_user(username, password) Logs user into the system - - ### Required Parameters Name | Type | Description | Notes @@ -181,8 +173,6 @@ No authorization required > logout_user() Logs out current logged in user session - - ### Required Parameters This endpoint does not need any parameter. @@ -197,12 +187,12 @@ No authorization required ### HTTP request headers - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) # **update_user** -> update_user(username, body) +> update_user(username, user) Updated user This can only be done by the logged in user. @@ -212,7 +202,7 @@ This can only be done by the logged in user. Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **username** | **String**| name that need to be deleted | - **body** | [**User**](User.md)| Updated user object | + **user** | [**User**](User.md)| Updated user object | ### Return type @@ -224,8 +214,8 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined - - **Accept**: application/xml, application/json + - **Content-Type**: application/json + - **Accept**: Not defined [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) diff --git a/samples/client/petstore/rust/src/apis/pet_api.rs b/samples/client/petstore/rust/src/apis/pet_api.rs index 41199bc61ca..4f0a5011464 100644 --- a/samples/client/petstore/rust/src/apis/pet_api.rs +++ b/samples/client/petstore/rust/src/apis/pet_api.rs @@ -35,19 +35,19 @@ impl PetApiClient { } pub trait PetApi { - fn add_pet(&self, body: ::models::Pet) -> Box>>; + fn add_pet(&self, pet: ::models::Pet) -> Box>>; fn delete_pet(&self, pet_id: i64, api_key: &str) -> Box>>; fn find_pets_by_status(&self, status: Vec) -> Box, Error = Error>>; fn find_pets_by_tags(&self, tags: Vec) -> Box, Error = Error>>; fn get_pet_by_id(&self, pet_id: i64) -> Box>>; - fn update_pet(&self, body: ::models::Pet) -> Box>>; + fn update_pet(&self, pet: ::models::Pet) -> Box>>; fn update_pet_with_form(&self, pet_id: i64, name: &str, status: &str) -> Box>>; fn upload_file(&self, pet_id: i64, additional_metadata: &str, file: ::models::File) -> Box>>; } implPetApi for PetApiClient { - fn add_pet(&self, body: ::models::Pet) -> Box>> { + fn add_pet(&self, pet: ::models::Pet) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let mut auth_headers = HashMap::::new(); @@ -88,7 +88,7 @@ implPetApi for PetApiClient { req.headers_mut().set_raw(key, val); } - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&pet).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); @@ -381,7 +381,7 @@ implPetApi for PetApiClient { ) } - fn update_pet(&self, body: ::models::Pet) -> Box>> { + fn update_pet(&self, pet: ::models::Pet) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let mut auth_headers = HashMap::::new(); @@ -422,7 +422,7 @@ implPetApi for PetApiClient { req.headers_mut().set_raw(key, val); } - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&pet).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); diff --git a/samples/client/petstore/rust/src/apis/store_api.rs b/samples/client/petstore/rust/src/apis/store_api.rs index a4726b7b139..2b1defa037c 100644 --- a/samples/client/petstore/rust/src/apis/store_api.rs +++ b/samples/client/petstore/rust/src/apis/store_api.rs @@ -38,7 +38,7 @@ pub trait StoreApi { fn delete_order(&self, order_id: &str) -> Box>>; fn get_inventory(&self, ) -> Box, Error = Error>>; fn get_order_by_id(&self, order_id: i64) -> Box>>; - fn place_order(&self, body: ::models::Order) -> Box>>; + fn place_order(&self, order: ::models::Order) -> Box>>; } @@ -206,7 +206,7 @@ implStoreApi for StoreApiClient { ) } - fn place_order(&self, body: ::models::Order) -> Box>> { + fn place_order(&self, order: ::models::Order) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let method = hyper::Method::Post; @@ -231,7 +231,7 @@ implStoreApi for StoreApiClient { - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&order).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); diff --git a/samples/client/petstore/rust/src/apis/user_api.rs b/samples/client/petstore/rust/src/apis/user_api.rs index 947932c5a70..56331005576 100644 --- a/samples/client/petstore/rust/src/apis/user_api.rs +++ b/samples/client/petstore/rust/src/apis/user_api.rs @@ -35,19 +35,19 @@ impl UserApiClient { } pub trait UserApi { - fn create_user(&self, body: ::models::User) -> Box>>; - fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box>>; - fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box>>; + fn create_user(&self, user: ::models::User) -> Box>>; + fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box>>; + fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box>>; fn delete_user(&self, username: &str) -> Box>>; fn get_user_by_name(&self, username: &str) -> Box>>; fn login_user(&self, username: &str, password: &str) -> Box>>; fn logout_user(&self, ) -> Box>>; - fn update_user(&self, username: &str, body: ::models::User) -> Box>>; + fn update_user(&self, username: &str, user: ::models::User) -> Box>>; } implUserApi for UserApiClient { - fn create_user(&self, body: ::models::User) -> Box>> { + fn create_user(&self, user: ::models::User) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let method = hyper::Method::Post; @@ -72,7 +72,7 @@ implUserApi for UserApiClient { - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&user).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); @@ -98,7 +98,7 @@ implUserApi for UserApiClient { ) } - fn create_users_with_array_input(&self, body: Vec<::models::User>) -> Box>> { + fn create_users_with_array_input(&self, user: Vec<::models::User>) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let method = hyper::Method::Post; @@ -123,7 +123,7 @@ implUserApi for UserApiClient { - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&user).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); @@ -149,7 +149,7 @@ implUserApi for UserApiClient { ) } - fn create_users_with_list_input(&self, body: Vec<::models::User>) -> Box>> { + fn create_users_with_list_input(&self, user: Vec<::models::User>) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let method = hyper::Method::Post; @@ -174,7 +174,7 @@ implUserApi for UserApiClient { - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&user).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized); @@ -396,7 +396,7 @@ implUserApi for UserApiClient { ) } - fn update_user(&self, username: &str, body: ::models::User) -> Box>> { + fn update_user(&self, username: &str, user: ::models::User) -> Box>> { let configuration: &configuration::Configuration = self.configuration.borrow(); let method = hyper::Method::Put; @@ -421,7 +421,7 @@ implUserApi for UserApiClient { - let serialized = serde_json::to_string(&body).unwrap(); + let serialized = serde_json::to_string(&user).unwrap(); req.headers_mut().set(hyper::header::ContentType::json()); req.headers_mut().set(hyper::header::ContentLength(serialized.len() as u64)); req.set_body(serialized);