Netflix / dgs-codegen

Apache License 2.0
183 stars 100 forks source link

Do we have a way to avoid the Java keywords #478

Open git4x opened 2 years ago

git4x commented 2 years ago

there is an type has three values, public, private and share. image so, with the code generation, it generates an Enum like

Enum BoardKind {
public,
private,
share
}

while public and private are Java reserved keywords, this will fail compile.

michaelboyles commented 2 years ago

Enum members are constants so should be uppercase anyway. GraphQL docs use uppercase for them. If you do that, there will be no name clash.

git4x commented 2 years ago

@michaelboyles yes, but unfortunately, the GraphQL API I am trying to integrate with is defining an Enum with lower-case values image

usama-gyg commented 1 year ago

we have a similar situation, we are integrating with an existing schema that has defined enums in lowercase. Is any workaround available to handle this situation?

srinivasankavitha commented 1 year ago

We'll need to handle this explicitly for enums since we only have a fix for handling keywords as typenames.

On Mon, Jun 26, 2023 at 1:42 AM Usama @.***> wrote:

we have a similar situation, we are integrating with an existing schema that has defined enums in lowercase. Is any workaround available to handle this situation?

— Reply to this email directly, view it on GitHub https://github.com/Netflix/dgs-codegen/issues/478#issuecomment-1606986093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJ5JPXPSHUWDDC7XOAN6CETXNFDOBANCNFSM6AAAAAARJXAEYY . You are receiving this because you are subscribed to this thread.Message ID: @.***>