Skip to content

Conversation

@sdghchj
Copy link
Member

@sdghchj sdghchj commented Feb 6, 2024

Describe the PR
Support primitive type with format in response

Relation issue
#1714

@codecov
Copy link

codecov bot commented Feb 6, 2024

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.38%. Comparing base (7147984) to head (045542b).
⚠️ Report is 62 commits behind head on master.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sdghchj sdghchj requested a review from ubogdan February 6, 2024 03:02
NUMBER: {"float": true, "double": true},
STRING: {"byte": true, "binary": true, "date": true, "date-time": true, "password": true},
}

Copy link
Contributor

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"`
Copy link
Contributor

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 🔦

@sdghchj sdghchj closed this Jul 30, 2025
@sdghchj sdghchj deleted the response_primitive_format branch July 30, 2025 01:57
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.

3 participants