feat(compiler): Add SchemaCoordinate::lookup
methods
#803
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All the coordinate types have a
.lookup(&schema)
method.I omitted the
SchemaLookup
trait that used to be in #757. It was only there to supportschema.lookup(&coord)
, but that's exactly the same as writingcoord.lookup(&schema)
, and it's simpler not to have both.Type attribute coordinate syntax can refer to object or interface field definitions, input
field definitions, and enum values.
TypeAttributeCoordinate::lookup
returns an enum toaccount for those possibilities. To look up a specific kind of type attribute, there are
convenience methods:
TypeAttributeCoordinate::lookup_field
for object or interface fieldsTypeAttributeCoordinate::lookup_input_field
for input fieldsTypeAttributeCoordinate::lookup_enum_value
for enum valuesThis should help with writing assertions in tests where you normally already know what
type you expect.