I'm using the (unofficial) swagger-codegen-cli Docker container from https://hub.docker.com/r/jimschubert/swagger-codegen-cli/ which pulls swagger-codegen from the master branch before it runs. I tried grabbing the recently documented (official) swagger-codegen-cli from https://hub.docker.com/r/swaggerapi/swagger-codegen-cli/, but it appears to be unavailable at the moment.
As it stands with the unofficial cli, I have generated a C# SDK from swagger documentation that contains the following:
/api/customer/{zoneId}/files/cover/gallery: {
get: {
tags: [
"FileUpload"
],
summary: "Get all files in customer cover gallery",
operationId: "FileUpload_GetCustomerCoverFiles",
consumes: [ ],
produces: [
"application/json",
"text/json"
],
parameters: [
{
name: "zoneId",
in: "path",
description: "",
required: true,
type: "integer",
format: "int32"
}
],
responses: {
200: {
description: "OK",
schema: {
type: "array",
items: {
$ref: "#/definitions/FileUploadGalleryItemModel"
}
}
}
}
},
post: {
tags: [
"FileUpload"
],
summary: "Upload file to customer cover gallery",
operationId: "FileUpload_CreateCustomerCoverGalleryItem",
consumes: [
"application/octet-stream"
],
produces: [
"application/json",
"text/json"
],
parameters: [
{
name: "zoneId",
in: "path",
description: "",
required: true,
type: "integer",
format: "int32"
},
{
name: "payload",
in: "body",
description: "",
required: true,
type: "byte[]",
format: "binary"
}
],
responses: {
200: {
description: "OK",
schema: {
type: "array",
items: {
$ref: "#/definitions/FileUploadGalleryItemModel"
}
}
}
}
}
},
The 'payload' is provided within the body of the request, however I don't see any way to provide the body to the method generated within the SDK with the following signature: public List<FileUploadGalleryItemModel> FileUploadCreateCustomerCoverGalleryItem (int? zoneId)
.
Any suggestions on what I might be overlooking or doing incorrectly?
You can document payload
as file (form parameter) instead, e.g. https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml#L269-L273, and you will find sample code in the auto-generated documentation (please take a look at the auto-generated README.md as a starting point)