[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.