Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
4 of 5 tasks
partkyle opened this issue Mar 4, 2019 · 2 comments · Fixed by #5611
Closed
4 of 5 tasks

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

partkyle opened this issue Mar 4, 2019 · 2 comments · Fixed by #5611

Comments

@partkyle
Copy link

partkyle commented Mar 4, 2019

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.

@wing328
Copy link
Member

wing328 commented Mar 5, 2019

@partkyle would creating the mustache tags is2xx, is3xx, is4xx help?

@partkyle
Copy link
Author

partkyle commented Mar 5, 2019

I could see that being helpful, since this is just to add an error handling case. I'm trying to work out if there's a way to structure the code differently to not need that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants