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
  • #524
Closed
Open
Issue created Jul 10, 2018 by Administrator@rootContributor

[Rust] client codegen regression for $refed response schema

Created by: euank

Description
openapi-generator version

This issue was introduced in commit 53597764. Before that commit, the below example definition worked.

OpenAPI declaration file content or url
{
  "consumes": [
    "application/json",
    "application/x-www-form-urlencoded"
  ],
  "produces": [
    "application/json"
  ],
  "schemes": [
    "http",
    "https"
  ],
  "swagger": "2.0",
  "info": {
    "description": "example",
    "title": "Example",
    "contact": {
      "name": "example"
    },
    "license": {
      "name": "Apache 2.0",
      "url": "..."
    },
    "version": "Latest"
  },
  "basePath": "/",
  "paths": {
    "/health/status": {
      "get": {
        "description": "health status",
        "tags": [
          "health"
        ],
        "summary": "Check the Health Status",
        "operationId": "getInstanceStatus",
        "responses": {
          "200": {
            "$ref": "#/responses/healthStatus"
          }
        }
      }
    }
  },
  "definitions": { },
  "responses": {
    "emptyResponse": {
      "description": "An empty response"
    },
    "healthStatus": {
      "description": "Instance health report",
      "schema": {
        "type": "object",
        "properties": {
          "status": {
            "description": "Status always contains \"ok\"",
            "type": "string"
          }
        }
      }
    }
  }
}
Command line used for generation
java -jar "/path/to/openapi-generator-cli.jar" generate -l rust -i ./example.json -DpackageName=example -DpackageVersion=0.1.0 -o .
Steps to reproduce

Running cargo check will produce an error:

$ cargo check
error[E0412]: cannot find type `Value` in this scope
  --> src/apis/health_api.rs:38:58
   |
38 |     fn get_instance_status(&self, ) -> Box<Future<Item = Value, Error = Error<serde_json::Value>>>;

Before that commit, the generated code looked like:

pub trait HealthApi {
    fn get_instance_status(&self, ) -> Box<Future<Item = ::models::InlineResponse200, Error = Error<serde_json::Value>>>;
}

After that change, it generates the invalid Item = Value instead.

Assignee
Assign to
Time tracking