Skip to content
Merged
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 @@ -51,17 +51,17 @@ public RustClientCodegen() {

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"
"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"
)
);

Expand All @@ -73,10 +73,10 @@ public RustClientCodegen() {

languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64",
"f32", "f64",
"char", "bool", "String", "Vec<u8>", "File")
"i8", "i16", "i32", "i64",
"u8", "u16", "u32", "u64",
"f32", "f64",
"char", "bool", "String", "Vec<u8>", "File")
);

instantiationTypes.clear();
Expand Down Expand Up @@ -386,7 +386,7 @@ public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
p.dataType = "::std::collections::HashMap<String, super::" + rt.substring("::std::collections::HashMap<String, ".length(), end).trim() + ">";
}
} else if (!languageSpecificPrimitives.contains(p.dataType)) {
// add super:: to model, e.g. super::pet
// add super:: to model, e.g. super::pet
p.dataType = "super::" + p.dataType;
}
}*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Go API client for {{packageName}}
# Rust API client for {{packageName}}

{{#appDescription}}
{{{appDescription}}}
Expand Down
10 changes: 5 additions & 5 deletions modules/swagger-codegen/src/main/resources/rust/api.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ use futures::{Future, Stream};

use super::{Error, configuration};

pub struct {{{classname}}}Impl<C: hyper::client::Connect> {
pub struct {{{classname}}}Client<C: hyper::client::Connect> {
configuration: Rc<configuration::Configuration<C>>,
}

impl<C: hyper::client::Connect> {{{classname}}}Impl<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Impl<C> {
{{{classname}}}Impl {
impl<C: hyper::client::Connect> {{{classname}}}Client<C> {
pub fn new(configuration: Rc<configuration::Configuration<C>>) -> {{{classname}}}Client<C> {
{{{classname}}}Client {
configuration: configuration,
}
}
Expand All @@ -30,7 +30,7 @@ pub trait {{classname}} {
}


impl<C: hyper::client::Connect>{{classname}} for {{classname}}Impl<C> {
impl<C: hyper::client::Connect>{{classname}} for {{classname}}Client<C> {
{{#operations}}
{{#operation}}
fn {{{operationId}}}(&self, {{#allParams}}{{paramName}}: {{#isString}}&str{{/isString}}{{^isString}}{{^isPrimitiveType}}{{^isContainer}}::models::{{/isContainer}}{{/isPrimitiveType}}{{{dataType}}}{{/isString}}{{#hasMore}}, {{/hasMore}}{{/allParams}}) -> Box<Future<Item = {{^returnType}}(){{/returnType}}{{#returnType}}{{{.}}}{{/returnType}}, Error = Error>> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ mod {{classFilename}};
{{#operations}}
{{#operation}}
{{#-last}}
pub use self::{{classFilename}}::{{classname}};
pub use self::{{classFilename}}::{{classname}}Impl;
pub use self::{{classFilename}}::{ {{classname}}, {{classname}}Client };
{{/-last}}
{{/operation}}
{{/operations}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ pub struct APIClient<C: hyper::client::Connect> {
impl<C: hyper::client::Connect> APIClient<C> {
pub fn new(configuration: Configuration<C>) -> APIClient<C> {
let rc = Rc::new(configuration);

APIClient {
configuration: rc.clone(),
{{#apiInfo}}
{{#apis}}
{{#operations}}
{{#operation}}
{{#-last}}
{{classFilename}}: Box::new(::apis::{{classname}}Impl::new(rc.clone())),
{{classFilename}}: Box::new(::apis::{{classname}}Client::new(rc.clone())),
{{/-last}}
{{/operation}}
{{/operations}}
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/rust/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Go API client for swagger
# Rust API client for swagger

This is a sample server Petstore server. You can find out more about Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/). For this sample, you can use the api key `special-key` to test the authorization filters.

Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/rust/docs/Pet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**id** | **i64** | | [optional] [default to null]
**category** | [***::models::category::Category**](Category.md) | | [optional] [default to null]
**category** | [***::models::Category**](Category.md) | | [optional] [default to null]
**name** | **String** | | [default to null]
**photo_urls** | **Vec<String>** | | [default to null]
**tags** | [**Vec<::models::tag::Tag>**](Tag.md) | | [optional] [default to null]
**tags** | [**Vec<::models::Tag>**](Tag.md) | | [optional] [default to null]
**status** | **String** | pet status in the store | [optional] [default to null]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
16 changes: 8 additions & 8 deletions samples/client/petstore/rust/docs/PetApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ 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)

# **FindPetsByStatus**
> Vec<::models::pet::Pet> FindPetsByStatus(ctx, status)
> Vec<::models::Pet> FindPetsByStatus(ctx, status)
Finds Pets by status

Multiple status values can be provided with comma separated strings
Expand All @@ -94,7 +94,7 @@ Name | Type | Description | Notes

### Return type

[**Vec<::models::pet::Pet>**](Pet.md)
[**Vec<::models::Pet>**](Pet.md)

### Authorization

Expand All @@ -108,7 +108,7 @@ 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)

# **FindPetsByTags**
> Vec<::models::pet::Pet> FindPetsByTags(ctx, tags)
> Vec<::models::Pet> FindPetsByTags(ctx, tags)
Finds Pets by tags

Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.
Expand All @@ -122,7 +122,7 @@ Name | Type | Description | Notes

### Return type

[**Vec<::models::pet::Pet>**](Pet.md)
[**Vec<::models::Pet>**](Pet.md)

### Authorization

Expand All @@ -136,7 +136,7 @@ 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)

# **GetPetById**
> ::models::pet::Pet GetPetById(ctx, pet_id)
> ::models::Pet GetPetById(ctx, pet_id)
Find pet by ID

Returns a single pet
Expand All @@ -150,7 +150,7 @@ Name | Type | Description | Notes

### Return type

[**::models::pet::Pet**](Pet.md)
[**::models::Pet**](Pet.md)

### Authorization

Expand Down Expand Up @@ -230,7 +230,7 @@ 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)

# **UploadFile**
> ::models::api_response::ApiResponse UploadFile(ctx, pet_id, optional)
> ::models::ApiResponse UploadFile(ctx, pet_id, optional)
uploads an image


Expand All @@ -254,7 +254,7 @@ Name | Type | Description | Notes

### Return type

[**::models::api_response::ApiResponse**](ApiResponse.md)
[**::models::ApiResponse**](ApiResponse.md)

### Authorization

Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/rust/docs/StoreApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ This endpoint does not need any parameter.
[[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)

# **GetOrderById**
> ::models::order::Order GetOrderById(order_id)
> ::models::Order GetOrderById(order_id)
Find purchase order by ID

For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions
Expand All @@ -75,7 +75,7 @@ Name | Type | Description | Notes

### Return type

[**::models::order::Order**](Order.md)
[**::models::Order**](Order.md)

### Authorization

Expand All @@ -89,7 +89,7 @@ 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)

# **PlaceOrder**
> ::models::order::Order PlaceOrder(body)
> ::models::Order PlaceOrder(body)
Place an order for a pet


Expand All @@ -102,7 +102,7 @@ Name | Type | Description | Notes

### Return type

[**::models::order::Order**](Order.md)
[**::models::Order**](Order.md)

### Authorization

Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/rust/docs/UserApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Creates list of users with given input array

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec&lt;::models::user::User&gt;**](User.md)| List of user object |
**body** | [**Vec&lt;::models::User&gt;**](User.md)| List of user object |

### Return type

Expand All @@ -78,7 +78,7 @@ Creates list of users with given input array

Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Vec&lt;::models::user::User&gt;**](User.md)| List of user object |
**body** | [**Vec&lt;::models::User&gt;**](User.md)| List of user object |

### Return type

Expand Down Expand Up @@ -123,7 +123,7 @@ 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)

# **GetUserByName**
> ::models::user::User GetUserByName(username)
> ::models::User GetUserByName(username)
Get user by user name


Expand All @@ -136,7 +136,7 @@ Name | Type | Description | Notes

### Return type

[**::models::user::User**](User.md)
[**::models::User**](User.md)

### Authorization

Expand Down
Loading