Add support for entities without a reference resolver #1378
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.
Resolves #1361
Heya 馃憢
This PR adds support for defining entities without a reference resolver using the
resolvable
parameter of the@key
directive on theSimpleObject
andObject
macros.The key to be marked unresolvable can be either implicitly (
#[graphql(unresolvable)]
) or explicitly (#[graphql(unresolvable = "<key>")]
) defined. When implicitly defined, the macro assumes all non-skipped fields are part of the key. When explicitly defined, the macro assumes the provided key is valid for the object. The explicit key will most likely be used for entities referenced by compound keys with nested fields, which cannot be easily validated.This should not be a breaking change. The
resolvable
argument defaults totrue
, so it will not affect schema generation unless explicitly requested.Example usage:
This example will generate the following schema:
These objects will also not be added to the
_Entity
union as they cannot be resolved by the subgraph.