Skip to content

[BUG][Go] Content type selection breaks when multiple content types present #10340

@wtrocki

Description

@wtrocki

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When API returns mixed content - 200 returns File/Binary and 500 returns JSON which is typical for error handling.
Generated code will include two accept headers. Problem is that selectHeaderAccept function that builds headers always forces accept headers to be JSON. As result server responses crash as server only knows how to set zip content type.

https://github.com/redhat-developer/app-services-sdk-go/blob/main/registryinstance/apiv1internal/client/api_admin.go#L1004-L1007

HTTPHeaderAccepts := []string{"application/zip", "application/json"}
openapi-generator version

5.2.1

OpenAPI declaration file content or URL

https://github.com/redhat-developer/app-services-sdk-go/blob/main/.openapi/registry-instance.json#L651-L665

Steps to reproduce
Related issues/PRs

#10337

Suggest a fix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions