Skip to content

Commit

Permalink
add bodyR to simplify body usage
Browse files Browse the repository at this point in the history
  • Loading branch information
zc2638 committed Dec 22, 2023
1 parent 958a34b commit c099653
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions endpoint/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ func FormData(name string, typ types.ParameterType, description string, required
}
}

// BodyR defines a body parameter for the swagger endpoint as would commonly be used for the POST, PUT, and PATCH methods
// prototype should be a struct or a pointer to struct that swag can use to reflect upon the return type
func BodyR(prototype interface{}) Option {
return bodyType(reflect.TypeOf(prototype), "", true)

Check warning on line 198 in endpoint/endpoint.go

View check run for this annotation

Codecov / codecov/patch

endpoint/endpoint.go#L197-L198

Added lines #L197 - L198 were not covered by tests
}

// Body defines a body parameter for the swagger endpoint as would commonly be used for the POST, PUT, and PATCH methods
// prototype should be a struct or a pointer to struct that swag can use to reflect upon the return type
func Body(prototype interface{}, description string, required bool) Option {
Expand Down

0 comments on commit c099653

Please sign in to comment.