Bug Report Checklist
Description
Files array in multipart/form-data requestBody produces following code:
// AddCard - Add card
func (c *DefaultApiController) AddCard(w http.ResponseWriter, r *http.Request) {
err := r.ParseForm()
if err != nil {
w.WriteHeader(500)
return
}
iD, err := parseIntParameter( r.FormValue("iD"))
if err != nil {
w.WriteHeader(500)
return
}
file, err := ReadFormFileToTempFile(r, "file")
if err != nil {
w.WriteHeader(500)
return
}
result, err := c.service.AddCard(iD, file)
if err != nil {
w.WriteHeader(500)
return
}
EncodeJSONResponse(result, nil, w)
}
Where file is of type *os.File, but service.AddCard expects []*os.File.
openapi-generator version
Reproducible with 3.4.1 and 5.0.0-beta3.
OpenAPI declaration file content or url
openapi: "3.0.0"
info:
version: 1.0.0
title: "Custom API"
servers:
- url: http://localhost:8080/api/v1
description: development server
paths:
/cards:
post:
summary: Add card
operationId: addCard
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
ID:
type: integer
format: int64
File:
type: array
items:
type: string
format: binary
responses:
'200':
description: Successful operation
Generation Details
Generated with
npx openapi-generator-cli generate -i openapi.yaml -g go-server -o server
Non-info output:
[main] WARN o.o.codegen.DefaultCodegen - Could not compute datatypeWithEnum from *os.File, null
[main] WARN o.o.c.languages.AbstractGoCodegen - 4.3.0 has deprecated the use of vendor extensions which don't follow lower-kebab casing standards with x- prefix.
Steps to reproduce
Generate a go-server with the command provided above or a Docker-container.
Related issues/PRs
Suggest a fix
PR (#8103)
Bug Report Checklist
Description
Files array in
multipart/form-datarequestBody produces following code:Where
fileis of type*os.File, butservice.AddCardexpects[]*os.File.openapi-generator version
Reproducible with 3.4.1 and 5.0.0-beta3.
OpenAPI declaration file content or url
Generation Details
Generated with
Non-info output:
Steps to reproduce
Generate a go-server with the command provided above or a Docker-container.
Related issues/PRs
Suggest a fix
PR (#8103)