Skip to content

Commit

Permalink
getkin#709 - Fix failing unit tests; format source code
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Lessard committed Dec 17, 2022
1 parent c8b9d46 commit 2fbce80
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
6 changes: 5 additions & 1 deletion openapi3filter/issue201_test.go
Expand Up @@ -17,7 +17,7 @@ func TestIssue201(t *testing.T) {
loader := openapi3.NewLoader()
ctx := loader.Context
spec := `
openapi: '3'
openapi: '3.0.3'
info:
version: 1.0.0
title: Sample API
Expand All @@ -37,20 +37,24 @@ paths:
description: ''
required: true
schema:
type: string
pattern: '^blip$'
x-blop:
description: ''
schema:
type: string
pattern: '^blop$'
X-Blap:
description: ''
required: true
schema:
type: string
pattern: '^blap$'
X-Blup:
description: ''
required: true
schema:
type: string
pattern: '^blup$'
`[1:]

Expand Down
5 changes: 2 additions & 3 deletions openapi3filter/validate_response.go
Expand Up @@ -80,8 +80,7 @@ func ValidateResponse(ctx context.Context, input *ResponseValidationInput) error
sort.Strings(headers)
for _, headerName := range headers {
headerRef := response.Headers[headerName]
err := validateResponseHeader(headerName, headerRef, input, opts)
if err != nil {
if err := validateResponseHeader(headerName, headerRef, input, opts); err != nil {
return err
}
}
Expand Down Expand Up @@ -158,7 +157,7 @@ func ValidateResponse(ctx context.Context, input *ResponseValidationInput) error
return nil
}

func validateResponseHeader(headerName string, headerRef *openapi3.HeaderRef, input *ResponseValidationInput, opts []openapi3.SchemaValidationOption, ) error {
func validateResponseHeader(headerName string, headerRef *openapi3.HeaderRef, input *ResponseValidationInput, opts []openapi3.SchemaValidationOption) error {
var err error
var decodedValue interface{}
var found bool
Expand Down
2 changes: 1 addition & 1 deletion openapi3filter/validate_response_test.go
Expand Up @@ -211,4 +211,4 @@ func newArraySchema(schema *openapi3.Schema) *openapi3.Schema {
arraySchema.Items = openapi3.NewSchemaRef("", schema)

return arraySchema
}
}

0 comments on commit 2fbce80

Please sign in to comment.