Skip to content
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

Fixed broken tests after libopenapi upgrade #41

Merged
merged 1 commit into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions errors/parameter_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ func HeaderParameterCannotBeDecoded(param *v3.Parameter, val string) *Validation
func IncorrectHeaderParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError {
var enums []string
for i := range sch.Enum {
enums = append(enums, fmt.Sprint(sch.Enum[i]))
enums = append(enums, fmt.Sprint(sch.Enum[i].Value))
}
validEnums := strings.Join(enums, ", ")
return &ValidationError{
Expand Down Expand Up @@ -236,7 +236,7 @@ func InvalidQueryParamNumber(param *v3.Parameter, ef string, sch *base.Schema) *
func IncorrectQueryParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError {
var enums []string
for i := range sch.Enum {
enums = append(enums, fmt.Sprint(sch.Enum[i]))
enums = append(enums, fmt.Sprint(sch.Enum[i].Value))
}
validEnums := strings.Join(enums, ", ")
return &ValidationError{
Expand All @@ -257,7 +257,7 @@ func IncorrectQueryParamEnumArray(param *v3.Parameter, ef string, sch *base.Sche
// look at that model fly!
for i := range param.GoLow().Schema.Value.Schema().Items.Value.A.Schema().Enum.Value {
enums = append(enums,
fmt.Sprint(param.GoLow().Schema.Value.Schema().Items.Value.A.Schema().Enum.Value[i].Value))
fmt.Sprint(param.GoLow().Schema.Value.Schema().Items.Value.A.Schema().Enum.Value[i].Value.Value))
}
validEnums := strings.Join(enums, ", ")
return &ValidationError{
Expand Down Expand Up @@ -346,7 +346,7 @@ func IncorrectCookieParamBool(param *v3.Parameter, ef string, sch *base.Schema)
func IncorrectCookieParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError {
var enums []string
for i := range sch.Enum {
enums = append(enums, fmt.Sprint(sch.Enum[i]))
enums = append(enums, fmt.Sprint(sch.Enum[i].Value))
}
validEnums := strings.Join(enums, ", ")
return &ValidationError{
Expand Down Expand Up @@ -409,7 +409,7 @@ func IncorrectPathParamBool(param *v3.Parameter, item string, sch *base.Schema)
func IncorrectPathParamEnum(param *v3.Parameter, ef string, sch *base.Schema) *ValidationError {
var enums []string
for i := range sch.Enum {
enums = append(enums, fmt.Sprint(sch.Enum[i]))
enums = append(enums, fmt.Sprint(sch.Enum[i].Value))
}
validEnums := strings.Join(enums, ", ")
return &ValidationError{
Expand Down
4 changes: 2 additions & 2 deletions parameters/cookie_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (v *paramValidator) ValidateCookieParams(request *http.Request) (bool, []*e
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(cookie.Value) == fmt.Sprint(enumVal) {
if strings.TrimSpace(cookie.Value) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down Expand Up @@ -105,7 +105,7 @@ func (v *paramValidator) ValidateCookieParams(request *http.Request) (bool, []*e
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(cookie.Value) == fmt.Sprint(enumVal) {
if strings.TrimSpace(cookie.Value) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down
4 changes: 2 additions & 2 deletions parameters/header_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (v *paramValidator) ValidateHeaderParams(request *http.Request) (bool, []*e
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(param) == fmt.Sprint(enumVal) {
if strings.TrimSpace(param) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down Expand Up @@ -123,7 +123,7 @@ func (v *paramValidator) ValidateHeaderParams(request *http.Request) (bool, []*e
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(param) == fmt.Sprint(enumVal) {
if strings.TrimSpace(param) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion parameters/path_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func (v *paramValidator) ValidatePathParams(request *http.Request) (bool, []*err
enumCheck := func(paramValue string) {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(paramValue) == fmt.Sprint(enumVal) {
if strings.TrimSpace(paramValue) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down
4 changes: 2 additions & 2 deletions parameters/query_parameters.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ doneLooking:
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(ef) == fmt.Sprint(enumVal) {
if strings.TrimSpace(ef) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand All @@ -134,7 +134,7 @@ doneLooking:
if sch.Enum != nil {
matchFound := false
for _, enumVal := range sch.Enum {
if strings.TrimSpace(ef) == fmt.Sprint(enumVal) {
if strings.TrimSpace(ef) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down
2 changes: 1 addition & 1 deletion parameters/validation_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ func ValidateQueryArray(
if itemsSch.Enum != nil {
matchFound := false
for _, enumVal := range itemsSch.Enum {
if strings.TrimSpace(enumCheck) == fmt.Sprint(enumVal) {
if strings.TrimSpace(enumCheck) == fmt.Sprint(enumVal.Value) {
matchFound = true
break
}
Expand Down