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: Kotlin GraphQL Code Gen on input type with default value is not correct #755

Closed
gaplo917 opened this issue Nov 27, 2021 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@gaplo917
Copy link

Expected behavior

Given the input with the empty object type
Screenshot 2021-11-27 at 12 20 09

I expect the generated type should looks like the following
Screenshot 2021-11-27 at 12 22 40

Actual behavior

Given the input with the empty object type
Screenshot 2021-11-27 at 12 20 09

the actual generated looks like
Screenshot 2021-11-27 at 12 19 46

Given the input with the object type with some default value
Screenshot 2021-11-27 at 12 20 43

the generated file have some default value inside, but the type is not correct.
Screenshot 2021-11-27 at 12 20 36

Steps to reproduce

  1. clone https://github.com/Netflix/dgs-examples-kotlin
  2. Modify the graphql schema to
input Something {
    sth1: Int = 0
    sth2: String = ""
}

input TitleFormat {
    uppercase: Boolean
    someInput: Something = {}
}

OR

input Something {
    sth1: Int = 0
    sth2: String = ""
}

input TitleFormat {
    uppercase: Boolean
    someInput: Something = { sth1: 1, sth2: "test" }
}
  1. run ./gradlew generateJava
  2. open ./build/generated/com/example/demo/generated/types/TitleFormat.kt
@gaplo917 gaplo917 added the bug Something isn't working label Nov 27, 2021
@srinivasankavitha
Copy link
Contributor

Thanks for reporting @gaplo917. This is actually an issue with the code generation plugin. Would you be able to move this issue to here: https://github.com/Netflix/dgs-codegen

@gaplo917
Copy link
Author

Moved.

Thanks for your great work on DGS @srinivasankavitha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants