Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample code for rust-server would not compile #8089

Open
Lingli05 opened this issue Apr 27, 2018 · 2 comments
Open

Sample code for rust-server would not compile #8089

Lingli05 opened this issue Apr 27, 2018 · 2 comments

Comments

@Lingli05
Copy link

Lingli05 commented Apr 27, 2018

Description

I am learning to use swagger-codegen for rust. Surprised to see the generated code from sample petstore would not compile:

samples/server/petstore/rust-server$ cargo build --example client
. . .
Compiling swagger v0.10.0
Compiling petstore_api v1.0.0 (file:///tmp/samples/server/petstore/rust-server)
error[E0412]: cannot find type object in this scope
--> src/lib.rs:297:56
|
297 | fn test_inline_additional_properties(&self, param: object, context: &Context) -> Box<Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError>>;
| ^^^^^^ not found in this scope

error[E0412]: cannot find type object in this scope
--> src/lib.rs:398:56
|
398 | fn test_inline_additional_properties(&self, param: object) -> Box<Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError>>;
| ^^^^^^ not found in this scope

error[E0412]: cannot find type object in this scope
--> src/lib.rs:528:56
|
528 | fn test_inline_additional_properties(&self, param: object) -> Box<Future<Item=TestInlineAdditionalPropertiesResponse, Error=ApiError>> {
| ^^^^^^ not found in this scope

error[E0412]: cannot find type object in this scope
--> src/client/mod.rs:979:62

Swagger-codegen version

latest: Building swagger-codegen-project 2.4.0-SNAPSHOT
Also tried swagger-codegen-2.3.1, same issue

Swagger declaration file content or url
Command line used for generation

2072 git init
2073 git pull git@github.com:swagger-api/swagger-codegen.git
2074 git pull https://github.com/swagger-api/swagger-codegen.git
2075 ls
2076 ./bin/rust-server-petstore.sh
2098 cd samples/
2099 ls
2100 cd server/
2101 ls
2102 cd petstore
2103 ls
2104 cd rust-server/
2105 ls
2106 ll
2107 cargo build --example client
2108 history

@Lingli05 Lingli05 changed the title sample code would not compile Sample code for rust-server would not compile Apr 27, 2018
@bjgill
Copy link
Contributor

bjgill commented May 15, 2018

Thanks for raising this. The problem is in TestInlineAdditionalProperties, which rust-server does not yet support. This is quite embarrassing, though.

I think there are two things needed:

  • Add support for additional properties (probably by throwing our hands in the air and returning a json::Object).
  • Create a rust-server-specific swagger template that only includes those features that rust-server supports. This would also allow us to add features that only rust-server supports.

@bjgill
Copy link
Contributor

bjgill commented May 15, 2018

I'm currently working on the second. It seems quite straightforward, so I'm hoping to get a PR within the next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants