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

Throwing an exception in codegen for empty enums #1282

Closed
wants to merge 2 commits into from

Conversation

jyoo980
Copy link
Contributor

@jyoo980 jyoo980 commented Feb 1, 2022

  • Caliban currently generates code for empty enums.
  • The generated code, however, fails to compile.
  • Although Caliban should successfully parse an empty enum, it should not
    generate code for one at all.
  • In this case, I throw an exception when code generation is attempted for
    an empty enum.

See #1253 for the full discussion on this.

Also closes #1253

  * Caliban currently generates code for empty enums.
  * The generated code, however, fails to compile.
  * Although Caliban should successfully parse an empty enum, it should _not_
    generate code for one at all.
  * In this case, I throw an exception when code generation is attempted for
    an empty enum.
@jyoo980
Copy link
Contributor Author

jyoo980 commented Feb 1, 2022

Ideally I'd like to add some tests for this behaviour. I don't see any code that executes failure cases in ClientWriterSpec.scala, would this be a good place to add them?

@ghostdogpr
Copy link
Owner

Ideally I'd like to add some tests for this behaviour. I don't see any code that executes failure cases in ClientWriterSpec.scala, would this be a good place to add them?

Yep that's okay! Note that you need to use enum MyEnum {} syntax, since enum MyEnum without braces will fail at parsing (#1252).

@ghostdogpr
Copy link
Owner

Closing old PRs, but feel free to reopen it targeting the series/2.x branch which is the new default.

@ghostdogpr ghostdogpr closed this Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken code generation for empty enums
2 participants