swagger-api / swagger-api/swagger-codegen

Sample code for rust-server would not compile

Open
#8,089 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure from samples/server/petstore/rust-server with cargo build --example client. Inspect the reported signatures in src/lib.rs and src/client/mod.rs and trace them back to the generated sample; done means the rust-server petstore example compiles successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.