Skip to content

Field#toString should include individual directives instead of DirectivesHolder object reference #4249

@oryan-block

Description

@oryan-block

Describe the bug
Not sure if this would be considered part of the API, but the toString of most objects in this project is fairly consistent in that it outputs human readable values.
This used to be the case for Field too until version 24/25 where the DirectivesHolder was introduced.

public String toString() {
    return "Field{" +
            "name='" + name + '\'' +
            ", alias='" + alias + '\'' +
            ", arguments=" + arguments +
            ", directives=" + directives + // <- used to be a List<Directive> now is DirectivesHolder
            ", selectionSet=" + selectionSet +
            '}';
}

Because DirectivesHolder doesn't have a toString implementation, if you write any object containing it to a log for example, it will result in something like:

SelectionSet{selections=[Field{name='description', alias='null', arguments=[], directives=graphql.language.NodeUtil$DirectivesHolder@64e8d216, selectionSet=null}]}

Would be nice if this were to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions