kin-openapi
kin-openapi copied to clipboard
openapi2conv: ToV3Response Missing header conversion
The current code is as follows,
func ToV3Response(response *entity.Response) (*openapi3.ResponseRef, error) {
if ref := response.Ref; ref != "" {
return &openapi3.ResponseRef{Ref: ToV3Ref(ref)}, nil
}
stripNonCustomExtensions(response.Extensions)
result := &openapi3.Response{
Description: &response.Description,
ExtensionProps: response.ExtensionProps,
}
if schemaRef := response.Schema; schemaRef != nil {
result.WithJSONSchemaRef(ToV3SchemaRef(schemaRef))
}
return &openapi3.ResponseRef{Value: result}, nil
}
Indeed headers (as well as examples) are not converted https://github.com/getkin/kin-openapi/blob/707e4ba1acb2ff3340c197dde6d4527b9e8bcbec/openapi2/openapi2.go#L216-L223
This snippet needs editing https://github.com/getkin/kin-openapi/blob/707e4ba1acb2ff3340c197dde6d4527b9e8bcbec/openapi2conv/openapi2_conv.go#L402-L415
cc https://github.com/getkin/kin-openapi/issues/366
PRs very welcomed :)
I think this issue can be closed. The problem seems to be fixed thanks to https://github.com/getkin/kin-openapi/pull/483.