# contains

open override fun <U : CompositeOutput.NotComposite> contains(field: Field<U>): Boolean(source)

Returns true if this SelectionSet includes the provided Field.

The provided field may describe a field on the current GraphQL type, or on a member type if the current type is a union, or on an implementing type if the current type is an interface.

Examples

Given this schema:

    interface Node { id: ID! }
    type Foo implements Node { id: ID! }

Content copied to clipboard

And given these selections on Node:

    ... on Foo { id }

Content copied to clipboard

Then:

- `contains(Foo.id)` returns true because the selections include an inline fragment on Foo that includes the id field

- `contains(Node.id)` returns false because the selections do not include a selection on Node.id that is not guarded by a type condition.