Skip to content

[BUG][Golang] client generations creates unreachable code #2296

@partkyle

Description

@partkyle

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
Description

The Go client generator creates code that cannot be reached. In the error handler all response codes are iterated over. It's not possible to have 200 level responses in this block, but they are all listed out. You can see the example here to show the issue I'm referring to. It's impossible for the status code to be >= 300 and then == 201.

openapi-generator version

4.0.0

This doesn't appear to be a regression because the problem can be seen in the sample code.

Suggest a fix

I'm not sure what's possible here, since mustache templates are logic-less. The solution may be just to leave it the way it is.

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