Skip to content

SchemaMappingInspector doesn't recognize Boolean methods named is* instead of get* #1332

@paulbakker

Description

@paulbakker

For a type with a boolean field as follows:

type Query {
    userConfig: UserConfig!
}

type UserConfig {
    allowed: Boolean!
}

GraphQL Java supports having a Java class with a isAllowed method as the "getter".

public class UserConfig {
    private final Boolean isAllowed;

    public UserConfig(Boolean isAllowed) {
        this.isAllowed = isAllowed;
    }

    public Boolean isAllowed() {
        return isAllowed;
    }

However, the SchemaMappingInspector does not recognize the isAllowed method. This is because it uses the CachedIntrospectionResults from Spring Framework, which uses PropertyDescriptor.
This works for getters but not for is* methods.

It will report an unmapped field:

	Unmapped fields: {UserConfig=[allowed]}
	Unmapped registrations: {}
	Unmapped arguments: {}
	Skipped types: []

The reason I think this might qualify as a bug is that GraphQL Java does support is* methods.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions