Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat. add support formData []file #1332

Merged
merged 1 commit into from Sep 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion operation.go
Expand Up @@ -226,7 +226,7 @@ func findInSlice(arr []string, target string) bool {
}

func (operation *Operation) parseArrayParam(param *spec.Parameter, paramType, refType, objectType string) error {
if !IsPrimitiveType(refType) {
if !IsPrimitiveType(refType) && !(refType == "file" && paramType == "formData") {
Copy link
Contributor

@ubogdan ubogdan Sep 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are cheating the validation because file is not a data type in go.

What is the spec output if I define type file as the following?

type file []string

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screen Shot 2022-09-19 at 11 50 33 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree this should work as it was provided in the example above but only for@consume x-www-form-urlencoded or @consume application/x-www-form-urlencoded.

A mix of in:formData with in:Body params should not be allowed.

return fmt.Errorf("%s is not supported array type for %s", refType, paramType)
}

Expand Down