Description
RequestWriter is typed to the body parameter, but does not account for the case where a body is not required, and thus is of type Option[T].
For instance:
def someOperation(body: SomeBody)(implicit reader: ClientResponseReader[SomeResponse], writer: RequestWriter[SomeBody)
is fine, but if if body above is Option[SomeBody] (because it's not required), then the following is generated:
def someOperation(body: Option[SomeBody] = None)(implicit reader: ClientResponseReader[SomeResponse], writer: RequestWriter[SomeBody)
which causes an error at this line because writer.write() is expecting SomeBody when it's actually Option[SomeBody].
Swagger-codegen version
2.3.0
Swagger declaration file content or url
https://download.elasticsearch.org/cloud/1.1/elastic-cloud-enterprise-API-swagger.json
Command line used for generation
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
-i https://download.elasticsearch.org/cloud/1.1/elastic-cloud-enterprise-API-swagger.json \
-l scala
Description
RequestWriteris typed to the body parameter, but does not account for the case where a body is not required, and thus is of typeOption[T].For instance:
is fine, but if if
bodyabove isOption[SomeBody](because it's not required), then the following is generated:which causes an error at this line because
writer.write()is expectingSomeBodywhen it's actuallyOption[SomeBody].Swagger-codegen version
2.3.0
Swagger declaration file content or url
https://download.elasticsearch.org/cloud/1.1/elastic-cloud-enterprise-API-swagger.json
Command line used for generation