Description
The Rust generated code fails to compile if the api defines a response type of object with no additional information. Other code generators like C# do generate code that compiles and runs even if it isn't a very useful response.
The errors look like:
error[E0412]: cannot find type `Value` in this scope
--> src\apis\file_api.rs:34:44
|
34 | fn clone(&self, ) -> Box<Future<Item = Value, Error = Error<serde_json::Value>>>;
| ^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
11 | use serde_json::Value;
|
11 | use serde_json::value::Value;
|
error[E0412]: cannot find type `Value` in this scope
--> src\apis\file_api.rs:39:44
|
39 | fn clone(&self, ) -> Box<Future<Item = Value, Error = Error<serde_json::Value>>> {
| ^^^^^ not found in this scope
help: possible candidates are found in other modules, you can import them into scope
|
11 | use serde_json::Value;
|
11 | use serde_json::value::Value;
openapi-generator version
3.3.2
OpenAPI declaration file content or url
{
"swagger": "2.0",
"info": {
"version": "v1.0",
"title": "test api"
},
"paths": {
"/api/clone": {
"put": {
"tags": [
"File"
],
"operationId": "Clone",
"consumes": [],
"produces": [
"application/json",
"text/json"
],
"parameters": [],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "object"
}
}
}
}
}
}
}
Command line used for generation
java -jar openapi-generator-cli.jar generate -i api.json -g rust
Steps to reproduce
java -jar openapi-generator-cli.jar generate -i api.json -g rust
cargo build
Related issues/PRs
Suggest a fix/enhancement
It looks like the return type could be serde_json::Value instead of Value, maybe as simple as changing this line.
Description
The Rust generated code fails to compile if the api defines a response type of
objectwith no additional information. Other code generators like C# do generate code that compiles and runs even if it isn't a very useful response.The errors look like:
openapi-generator version
3.3.2
OpenAPI declaration file content or url
{ "swagger": "2.0", "info": { "version": "v1.0", "title": "test api" }, "paths": { "/api/clone": { "put": { "tags": [ "File" ], "operationId": "Clone", "consumes": [], "produces": [ "application/json", "text/json" ], "parameters": [], "responses": { "200": { "description": "OK", "schema": { "type": "object" } } } } } } }Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement
It looks like the return type could be
serde_json::Valueinstead ofValue, maybe as simple as changing this line.