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

feat. add support formData []file #1332

merged 1 commit into from
Sep 27, 2022

Conversation

otakukaze
Copy link
Contributor

Describe the PR
add support formData multiple file

Relation issue
#866

@codecov
Copy link

codecov bot commented Sep 18, 2022

Codecov Report

Base: 95.64% // Head: 95.64% // No change to project coverage 👍

Coverage data is based on head (3dfacc7) compared to base (e4f0129).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1332   +/-   ##
=======================================
  Coverage   95.64%   95.64%           
=======================================
  Files          14       14           
  Lines        2871     2871           
=======================================
  Hits         2746     2746           
  Misses         70       70           
  Partials       55       55           
Impacted Files Coverage Δ
operation.go 96.24% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@@ -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.

Copy link
Contributor

@ubogdan ubogdan left a comment

Choose a reason for hiding this comment

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

LGTM

@ubogdan ubogdan merged commit 74e96c9 into swaggo:master Sep 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants