Replies: 2 comments 1 reply
-
|
take a look here: https://github.com/go-swagger/go-swagger/blob/master/fixtures/goparsing/classification/operations/noparams.go#L28-L33 |
Beta Was this translation helpful? Give feedback.
-
|
What should my struct look like if the file upload needs to be a part of a model with other native fields? Should it be like https://github.com/go-swagger/go-swagger/blob/master/fixtures/goparsing/classification/operations/noparams.go#L52-L58? Should every non-file upload file also have // in: formData? Also, when I use formData, serving swagger.json doesn't show the parameters of the endpoint that have in: formData |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Problem statement
怎么用 go-swagger 定义表单中的上传文件字段,


how can i use go-swagger generate doc from go source file comment for a field of file in formData?
i want the result such this ( for api-fox):
i need the filetest field, not file3 or other.
swagger.json such this
"parameters": [{"name": "filet",
"in": "formData",
"format": "binary",
"type": "string"
},{
"type": "file",
"description": "压缩包test2",
"name": "filetest2",
"in": "formData"
}]
Swagger specification
Steps to reproduce
this my swagger/docs/file.go file
file-swagger.txt
then exec command
swagger generate spec -o swagger.jsonbut i get the swagger.json belown
swagger.txt
it cant not generate the param like filetest
Environment
swagger version: v0.29.0
go version: go1.18.2
OS: windows10
Beta Was this translation helpful? Give feedback.
All reactions