downvote
This commit is contained in:
@@ -9,8 +9,10 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-openapi/errors"
|
||||
"github.com/go-openapi/runtime"
|
||||
"github.com/go-openapi/runtime/middleware"
|
||||
"github.com/go-openapi/strfmt"
|
||||
"github.com/go-openapi/validate"
|
||||
)
|
||||
|
||||
// NewGetFeedbacksForProjectParams creates a new GetFeedbacksForProjectParams object
|
||||
@@ -35,6 +37,11 @@ type GetFeedbacksForProjectParams struct {
|
||||
In: path
|
||||
*/
|
||||
ProjectID string
|
||||
/*Session UUID
|
||||
Required: true
|
||||
In: query
|
||||
*/
|
||||
SessionUUID string
|
||||
}
|
||||
|
||||
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
|
||||
@@ -46,10 +53,17 @@ func (o *GetFeedbacksForProjectParams) BindRequest(r *http.Request, route *middl
|
||||
|
||||
o.HTTPRequest = r
|
||||
|
||||
qs := runtime.Values(r.URL.Query())
|
||||
|
||||
rProjectID, rhkProjectID, _ := route.Params.GetOK("project_id")
|
||||
if err := o.bindProjectID(rProjectID, rhkProjectID, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
|
||||
qSessionUUID, qhkSessionUUID, _ := qs.GetOK("session_uuid")
|
||||
if err := o.bindSessionUUID(qSessionUUID, qhkSessionUUID, route.Formats); err != nil {
|
||||
res = append(res, err)
|
||||
}
|
||||
if len(res) > 0 {
|
||||
return errors.CompositeValidationError(res...)
|
||||
}
|
||||
@@ -69,3 +83,24 @@ func (o *GetFeedbacksForProjectParams) bindProjectID(rawData []string, hasKey bo
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// bindSessionUUID binds and validates parameter SessionUUID from query.
|
||||
func (o *GetFeedbacksForProjectParams) bindSessionUUID(rawData []string, hasKey bool, formats strfmt.Registry) error {
|
||||
if !hasKey {
|
||||
return errors.Required("session_uuid", "query", rawData)
|
||||
}
|
||||
var raw string
|
||||
if len(rawData) > 0 {
|
||||
raw = rawData[len(rawData)-1]
|
||||
}
|
||||
|
||||
// Required: true
|
||||
// AllowEmptyValue: false
|
||||
|
||||
if err := validate.RequiredString("session_uuid", "query", raw); err != nil {
|
||||
return err
|
||||
}
|
||||
o.SessionUUID = raw
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ import (
|
||||
type GetFeedbacksForProjectURL struct {
|
||||
ProjectID string
|
||||
|
||||
SessionUUID string
|
||||
|
||||
_basePath string
|
||||
// avoid unkeyed usage
|
||||
_ struct{}
|
||||
@@ -55,6 +57,15 @@ func (o *GetFeedbacksForProjectURL) Build() (*url.URL, error) {
|
||||
}
|
||||
_result.Path = golangswaggerpaths.Join(_basePath, _path)
|
||||
|
||||
qs := make(url.Values)
|
||||
|
||||
sessionUUIDQ := o.SessionUUID
|
||||
if sessionUUIDQ != "" {
|
||||
qs.Set("session_uuid", sessionUUIDQ)
|
||||
}
|
||||
|
||||
_result.RawQuery = qs.Encode()
|
||||
|
||||
return &_result, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user