Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #1430
Closed
Open
Issue created Nov 13, 2018 by Administrator@rootContributor

[rust client] Incomplete type in response generates code that fails to compile

Created by: lzybkr

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.

Assignee
Assign to
Time tracking