-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Milestone
Description
Describe the bug
If some boolean GraphQL field named isX and backed by DTO isX() getter, PropertyFetchingImpl fails to find such a getter.
Instead it tries isIsX().
Why (boolean) getter named so?
The problem is related to Kotlin properties:
If the name of the property starts with
is, a different name mapping rule is used: the name of the getter will be the same as the property name... This rule applies for properties of any type, not justBoolean.
https://kotlinlang.org/docs/java-to-kotlin-interop.html#properties
How to fix
Property fetcher should not add is prefix if a field already prefixed with it.
Or more general way: it should try getter without a prefix at all (getter name == field name) as a last resort.
To Reproduce
Schema:
type TheType {
isAwesome: Boolean
}Kotlin:
/**
* DTO
*/
class TheType(
val isAwesome: Boolean?
)Java:
/**
* DTO
*/
public class TheType {
private Boolean isAwesome;
public TheType(Boolean isAwesome) {
this.isAwesome = isAwesome;
}
public Boolean isAwesome() {
return isAwesome;
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels