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
bugfix type error in multipart-form payload #1863
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the detailed report and the great PR! I left a couple of comments that would be good to address. Thanks again.
goagen/gen_app/writers.go
Outdated
case design.NumberKind: | ||
return "ParseFloat" | ||
} | ||
panic("undefined strconv function") |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
goagen/gen_app/writers.go
Outdated
@@ -451,6 +456,34 @@ func arrayAttribute(a *design.AttributeDefinition) *design.AttributeDefinition { | |||
return a.Type.(*design.Array).ElemType | |||
} | |||
|
|||
func valueTypeOf(pr string, att *design.AttributeDefinition) string { |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raphael
I fixed the codes according to your comments. please review.
thank you.
return varName + ", (error)(nil)" | ||
case design.ArrayKind: | ||
case design.HashKind: | ||
return valueTypeOf("", att) + "{}, (error)(nil)" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
return varName + ", (error)(nil)" | ||
case design.ArrayKind: | ||
case design.HashKind: | ||
return valueTypeOf("", att) + "{}, (error)(nil)" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
case design.HashKind: | ||
return valueTypeOf("", att) + "{}, (error)(nil)" | ||
} | ||
return "(" + valueTypeOf("", att) + ")(nil), (error)(nil)" |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Thank you, definitely an improvement compared to the original code! |
One last request please, could you port this fix to master as well? (cherry-pick the merge commit). |
* bugfix type error in multipart-form payload * bugfix Array attribute error in multipartform * fix wrong comment line and add comment to new function * fix fromString func to do not cause panic and support some other types for array element
@raphael |
* bugfix type error in multipart-form payload * bugfix Array attribute error in multipartform * fix wrong comment line and add comment to new function * fix fromString func to do not cause panic and support some other types for array element
bugfix for #1862
type errors occur when set MultipartForm flag