-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Support primitive type with format in response #1754
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: sdghchj <[email protected]>
Signed-off-by: sdghchj <[email protected]>
Signed-off-by: sdghchj <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1754 +/- ##
==========================================
- Coverage 83.40% 83.38% -0.03%
==========================================
Files 16 16
Lines 3868 3875 +7
==========================================
+ Hits 3226 3231 +5
- Misses 544 545 +1
- Partials 98 99 +1 ☔ View full report in Codecov by Sentry. |
NUMBER: {"float": true, "double": true}, | ||
STRING: {"byte": true, "binary": true, "date": true, "date-time": true, "password": true}, | ||
} | ||
|
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.
Why don't use the reverse way
var validPrimitiveFormat = map[string]string{
"int32": "INTEGER"
"int64": "INTEGER"
"float": "NUMBER"
....
}
and the condition from operations.go
if !validPrimitiveFormat[refType] != schemaType {
err := operation.ParseComment(comment, nil) | ||
assert.Error(t, err) | ||
|
||
comment = `@Success 200 {integer} int32 "response with format"` |
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.
This is a stupid corner case , Can you show me an example how you send and receive an int32 over an HTTP request ? :)
Usually the response is a JSON object, not a string value 🔦
Describe the PR
Support primitive type with format in response
Relation issue
#1714