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

Fix import for type mapped union sub types #731

Conversation

ChristopherGustafson
Copy link
Contributor

Issue

When generating code for union types in Kotlin, type mappings are not taken into consideration. This results in broken Kotlin classes.

Steps to reproduce issue

Schema:

union Pet = Cat | Dog
type Cat implements Pet {
  name: ID!
}
type Dog implements Pet {
  name: ID!
}

And an implementation of Cat

package com.example.animals.types

data class Cat(val id: String, val color: String)

And finally a typeMapping for Cat

typeMapping = [
  "Cat": "com.example.animals.types.Cat"
]

Which results in errors in the generated Animal interface that complains about the missing type Cat.

Solution

A solution to this has already been implemented in the Java equivalent generator. Follow the same pattern and lookup the full class name of each member type.

Copy link
Contributor

@srinivasankavitha srinivasankavitha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@srinivasankavitha srinivasankavitha merged commit 69f01a1 into Netflix:master Aug 16, 2024
2 checks passed
@ChristopherGustafson
Copy link
Contributor Author

Thanks for the merge @srinivasankavitha! When are you planning the next release?

@srinivasankavitha
Copy link
Contributor

we will release early this week.

@ChristopherGustafson
Copy link
Contributor Author

Great!

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.

2 participants