I tried to generate java client code of a model containing oneOf, the code is generated but the generated class IObject (see the example) uses the class OneOfstringstring which is not generaated.
{
"openapi" : "3.0.0",
"info" : {
"title" : "Management API",
"contact" : {
"name" : "RD Development",
"email" : "[email protected]"
},
"version" : "0.1",
"x-restgeninfo" : { }
},
"servers" : [ {
"url" : "/"
} ],
"tags" : [ {
"name" : "ip"
} ],
"paths" : {
"/ip" : {
"get" : {
"tags" : [ "ip" ],
"summary" : "List IP objects",
"description" : "Lists all IP Addresses within the Database\n",
"operationId" : "ipList",
"parameters" : [ {
"$ref" : "#/components/parameters/x-page-token"
} ],
"responses" : {
"200" : {
"description" : "List of Matching IP objects",
"headers" : {
"X-PAGE-MARKER" : {
"$ref" : "#/components/schemas/HeaderPageMarker"
}
},
"content" : {
"application/json" : {
"schema" : {
"type" : "array",
"items" : {
"$ref" : "#/components/schemas/IPObject"
}
}
}
}
},
"401" : {
"$ref" : "#/components/responses/StatusResponse"
},
"403" : {
"$ref" : "#/components/responses/StatusResponse"
}
},
"x-accepts" : "application/json"
},
"put" : {
"tags" : [ "ip" ],
"summary" : "Set an IP object",
"description" : "Create/Replace an IP Object",
"operationId" : "ip_address_put",
"requestBody" : {
"description" : "IP Object",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/IPObject"
}
}
},
"required" : true
},
"responses" : {
"200" : {
"$ref" : "#/components/responses/StatusResponse"
},
"400" : {
"$ref" : "#/components/responses/StatusResponse"
},
"401" : {
"$ref" : "#/components/responses/StatusResponse"
},
"403" : {
"$ref" : "#/components/responses/StatusResponse"
}
},
"x-contentType" : "application/json",
"x-accepts" : "application/json"
}
},
"/ip/{address}" : {
"get" : {
"tags" : [ "ip" ],
"summary" : "Get an IP object",
"description" : "Get an IP object by its address",
"operationId" : "ip_address_get",
"parameters" : [ {
"$ref" : "#/components/parameters/address"
} ],
"responses" : {
"200" : {
"description" : "Matching IP object",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/IPObject"
}
}
}
},
"404" : {
"$ref" : "#/components/responses/StatusResponse"
},
"401" : {
"$ref" : "#/components/responses/StatusResponse"
},
"403" : {
"$ref" : "#/components/responses/StatusResponse"
}
},
"x-accepts" : "application/json"
},
"delete" : {
"tags" : [ "ip" ],
"summary" : "Delete an IP object",
"operationId" : "ip_address_delete",
"parameters" : [ {
"$ref" : "#/components/parameters/address"
} ],
"responses" : {
"200" : {
"$ref" : "#/components/responses/StatusResponse"
},
"404" : {
"$ref" : "#/components/responses/StatusResponse"
},
"401" : {
"$ref" : "#/components/responses/StatusResponse"
},
"403" : {
"$ref" : "#/components/responses/StatusResponse"
}
},
"x-accepts" : "application/json"
},
"parameters" : [ {
"$ref" : "#/components/parameters/address"
} ]
}
},
"components" : {
"schemas" : {
"HeaderPageMarker" : {
"type" : "string"
},
"StatusObject" : {
"required" : [ "message", "status" ],
"type" : "object",
"properties" : {
"status" : {
"type" : "string",
"enum" : [ "success", "error" ]
},
"message" : {
"type" : "string"
}
},
"additionalProperties" : false
},
"IPv6Address" : {
"type" : "string",
"format" : "IPv6"
},
"IPv4Address" : {
"type" : "string",
"format" : "IPv4"
},
"IPObject" : {
"required" : [ "address" ],
"type" : "object",
"properties" : {
"address" : {
"oneOf" : [ {
"$ref" : "#/components/schemas/IPv4Address"
}, {
"$ref" : "#/components/schemas/IPv6Address"
} ]
},
"start_time" : {
"type" : "string",
"format" : "date-time"
},
"end_time" : {
"type" : "string",
"format" : "date-time"
},
"action" : {
"type" : "string",
"enum" : [ "blackhole", "redirect" ]
},
"redirect_url" : {
"type" : "string"
},
"notes" : {
"type" : "string"
},
"created_at" : {
"type" : "string",
"format" : "date-time",
"readOnly" : true
},
"updated_at" : {
"type" : "string",
"format" : "date-time",
"readOnly" : true
}
},
"additionalProperties" : false,
"example" : {
"start_time" : "2000-01-23T04:56:07.000+00:00",
"address" : "",
"notes" : "notes",
"updated_at" : "2000-01-23T04:56:07.000+00:00",
"end_time" : "2000-01-23T04:56:07.000+00:00",
"action" : "blackhole",
"created_at" : "2000-01-23T04:56:07.000+00:00",
"redirect_url" : "redirect_url"
}
}
},
"responses" : {
"IPObjectResponse" : {
"description" : "IP object",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/IPObject"
}
}
}
},
"StatusResponse" : {
"description" : "Generic Status Message Response",
"content" : {
"application/json" : {
"schema" : {
"$ref" : "#/components/schemas/StatusObject"
}
}
}
}
},
"parameters" : {
"x-page-token" : {
"name" : "x-page-token",
"in" : "header",
"description" : "Pagination Token, for paged responses a token will be returned,\nThis should be provided on the next request to receive the next page.\n",
"required" : false,
"style" : "simple",
"explode" : false,
"schema" : {
"type" : "string"
}
},
"domainname" : {
"name" : "domainname",
"in" : "path",
"description" : "Domain Name",
"required" : true,
"style" : "simple",
"explode" : false,
"schema" : {
"type" : "string"
},
"example" : "google.com"
},
"address" : {
"name" : "address",
"in" : "path",
"description" : "IP Address",
"required" : true,
"style" : "simple",
"explode" : false,
"schema" : {
"oneOf" : [ {
"$ref" : "#/components/schemas/IPv6Address"
}, {
"$ref" : "#/components/schemas/IPv4Address"
} ]
},
"example" : "1.2.3.4"
},
"groupname" : {
"name" : "groupname",
"in" : "path",
"description" : "Group Name",
"required" : true,
"style" : "simple",
"explode" : false,
"schema" : {
"type" : "string"
},
"example" : "block_group_a"
}
},
"securitySchemes" : { }
}
}
Generate the above example with java client.
Description
I tried to generate java client code of a model containing oneOf, the code is generated but the generated class IObject (see the example) uses the class OneOfstringstring which is not generaated.
openapi-generator version
openapi-generator-cli-4.3.0-20200326.174439-234
OpenAPI declaration file content or url
The complete example :
{ "openapi" : "3.0.0", "info" : { "title" : "Management API", "contact" : { "name" : "RD Development", "email" : "[email protected]" }, "version" : "0.1", "x-restgeninfo" : { } }, "servers" : [ { "url" : "/" } ], "tags" : [ { "name" : "ip" } ], "paths" : { "/ip" : { "get" : { "tags" : [ "ip" ], "summary" : "List IP objects", "description" : "Lists all IP Addresses within the Database\n", "operationId" : "ipList", "parameters" : [ { "$ref" : "#/components/parameters/x-page-token" } ], "responses" : { "200" : { "description" : "List of Matching IP objects", "headers" : { "X-PAGE-MARKER" : { "$ref" : "#/components/schemas/HeaderPageMarker" } }, "content" : { "application/json" : { "schema" : { "type" : "array", "items" : { "$ref" : "#/components/schemas/IPObject" } } } } }, "401" : { "$ref" : "#/components/responses/StatusResponse" }, "403" : { "$ref" : "#/components/responses/StatusResponse" } }, "x-accepts" : "application/json" }, "put" : { "tags" : [ "ip" ], "summary" : "Set an IP object", "description" : "Create/Replace an IP Object", "operationId" : "ip_address_put", "requestBody" : { "description" : "IP Object", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/IPObject" } } }, "required" : true }, "responses" : { "200" : { "$ref" : "#/components/responses/StatusResponse" }, "400" : { "$ref" : "#/components/responses/StatusResponse" }, "401" : { "$ref" : "#/components/responses/StatusResponse" }, "403" : { "$ref" : "#/components/responses/StatusResponse" } }, "x-contentType" : "application/json", "x-accepts" : "application/json" } }, "/ip/{address}" : { "get" : { "tags" : [ "ip" ], "summary" : "Get an IP object", "description" : "Get an IP object by its address", "operationId" : "ip_address_get", "parameters" : [ { "$ref" : "#/components/parameters/address" } ], "responses" : { "200" : { "description" : "Matching IP object", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/IPObject" } } } }, "404" : { "$ref" : "#/components/responses/StatusResponse" }, "401" : { "$ref" : "#/components/responses/StatusResponse" }, "403" : { "$ref" : "#/components/responses/StatusResponse" } }, "x-accepts" : "application/json" }, "delete" : { "tags" : [ "ip" ], "summary" : "Delete an IP object", "operationId" : "ip_address_delete", "parameters" : [ { "$ref" : "#/components/parameters/address" } ], "responses" : { "200" : { "$ref" : "#/components/responses/StatusResponse" }, "404" : { "$ref" : "#/components/responses/StatusResponse" }, "401" : { "$ref" : "#/components/responses/StatusResponse" }, "403" : { "$ref" : "#/components/responses/StatusResponse" } }, "x-accepts" : "application/json" }, "parameters" : [ { "$ref" : "#/components/parameters/address" } ] } }, "components" : { "schemas" : { "HeaderPageMarker" : { "type" : "string" }, "StatusObject" : { "required" : [ "message", "status" ], "type" : "object", "properties" : { "status" : { "type" : "string", "enum" : [ "success", "error" ] }, "message" : { "type" : "string" } }, "additionalProperties" : false }, "IPv6Address" : { "type" : "string", "format" : "IPv6" }, "IPv4Address" : { "type" : "string", "format" : "IPv4" }, "IPObject" : { "required" : [ "address" ], "type" : "object", "properties" : { "address" : { "oneOf" : [ { "$ref" : "#/components/schemas/IPv4Address" }, { "$ref" : "#/components/schemas/IPv6Address" } ] }, "start_time" : { "type" : "string", "format" : "date-time" }, "end_time" : { "type" : "string", "format" : "date-time" }, "action" : { "type" : "string", "enum" : [ "blackhole", "redirect" ] }, "redirect_url" : { "type" : "string" }, "notes" : { "type" : "string" }, "created_at" : { "type" : "string", "format" : "date-time", "readOnly" : true }, "updated_at" : { "type" : "string", "format" : "date-time", "readOnly" : true } }, "additionalProperties" : false, "example" : { "start_time" : "2000-01-23T04:56:07.000+00:00", "address" : "", "notes" : "notes", "updated_at" : "2000-01-23T04:56:07.000+00:00", "end_time" : "2000-01-23T04:56:07.000+00:00", "action" : "blackhole", "created_at" : "2000-01-23T04:56:07.000+00:00", "redirect_url" : "redirect_url" } } }, "responses" : { "IPObjectResponse" : { "description" : "IP object", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/IPObject" } } } }, "StatusResponse" : { "description" : "Generic Status Message Response", "content" : { "application/json" : { "schema" : { "$ref" : "#/components/schemas/StatusObject" } } } } }, "parameters" : { "x-page-token" : { "name" : "x-page-token", "in" : "header", "description" : "Pagination Token, for paged responses a token will be returned,\nThis should be provided on the next request to receive the next page.\n", "required" : false, "style" : "simple", "explode" : false, "schema" : { "type" : "string" } }, "domainname" : { "name" : "domainname", "in" : "path", "description" : "Domain Name", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string" }, "example" : "google.com" }, "address" : { "name" : "address", "in" : "path", "description" : "IP Address", "required" : true, "style" : "simple", "explode" : false, "schema" : { "oneOf" : [ { "$ref" : "#/components/schemas/IPv6Address" }, { "$ref" : "#/components/schemas/IPv4Address" } ] }, "example" : "1.2.3.4" }, "groupname" : { "name" : "groupname", "in" : "path", "description" : "Group Name", "required" : true, "style" : "simple", "explode" : false, "schema" : { "type" : "string" }, "example" : "block_group_a" } }, "securitySchemes" : { } } }Command line used for generation
I'm using OpenApi studio
Steps to reproduce
Generate the above example with java client.
Related issues/PRs
#5382