The code to validate the headers in an HTTP response will always fail if the header's data type is anything other than string.
The code at https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3filter/validate_response.go#L92 gets the value for a given header. The header's value, by the nature of http, is a string. This string is then passed to the VisitJSON method at https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3/schema.go#L810. The VisitJSON method expects the value that is passed in to have already been converted into the appropriate Go type. Because the value hasn't been converted the VisitJSON method will return an error for any header that is supposed to be an integer, number, boolean, or array.
I believe the solution is to insert some code between lines 92 and 93. This inserted code should switch on the value of s.Value.Schema.Value.Type and convert the string accordingly.
It looks like the function decaodeValue at https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3filter/req_resp_decoder.go#L259 might do the kind conversion that is needed
The code to validate the headers in an HTTP response will always fail if the header's data type is anything other than string.
The code at https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3filter/validate_response.go#L92 gets the value for a given header. The header's value, by the nature of http, is a string. This string is then passed to the
VisitJSONmethod at https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3/schema.go#L810. TheVisitJSONmethod expects the value that is passed in to have already been converted into the appropriate Go type. Because the value hasn't been converted theVisitJSONmethod will return an error for any header that is supposed to be an integer, number, boolean, or array.I believe the solution is to insert some code between lines 92 and 93. This inserted code should switch on the value of
s.Value.Schema.Value.Typeand convert the string accordingly.It looks like the function
decaodeValueat https://github.com/getkin/kin-openapi/blob/v0.110.0/openapi3filter/req_resp_decoder.go#L259 might do the kind conversion that is needed