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 #297

Open
gaplo917 opened this issue Nov 28, 2021 · 1 comment · May be fixed by #680
Open

bug: Kotlin GraphQL Code Gen on input type with default value is not correct #297

gaplo917 opened this issue Nov 28, 2021 · 1 comment · May be fixed by #680
Labels
bug Something isn't working good-first-issues

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

Repost from Netflix/dgs-framework#755

@berngp
Copy link
Contributor

berngp commented Dec 6, 2021

Thanks for reporting.

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