Releases: EntityGraphQL/EntityGraphQL
6.0.0-beta2
Changes
- Added
selectManymethod support to filter expressions, enabling flattening using nested collections within queries.
Fixes
- Fixed (maybe a regression introduced in 6.0.0-beta1)
UseFilter()incorrectly adding a default value to the filter argument when applied to fields that already have other arguments defined.
6.0.0-beta1
Breaking Changes
-
Support for partial results as per spec. This actually fixes EntityGraphQL to follow the GraphQL spec regarding partial results. However it does change behavior.
- EntityGraphQL basically executes each "top level" field in the operation separately, now if any fail, you'll get the partial results of those that succeeded and error information about the failed ones.
AddGraphQLValidatornow registersIGraphQLValidatorasTransient. This was the original intent as the docs have examples of bailing early by checking if the validator has any errors. The intent was errors for that field. This change helps enable partial results. If you want the old behavior, remove the use ofAddGraphQLValidatorand just addIGraphQLValidatoryourself asScoped- As per spec If an error was raised during the execution that prevented a valid response, the "data" entry in the response should be null. This was not always the case
-
Removed methods/properties marked as obsolete
IField.UseArgumentsFromFielduseGetExpressionAndArgumentsIField.UseArgumentsFromuseGetExpressionAndArgumentsIField.ResolveWithServiceuseResolveIFieldExtension.GetExpressionuse the newGetExpressionAndArguments
-
MapGraphQLfollowSpec = trueis now the default behavior, it follows https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md -
You can no longer add filter support by using
ArgumentHelper.EntityQueryorEntityQueryTypein the field args, e.g.schemaProvider.Query().ReplaceField("users", new { filter = ArgumentHelper.EntityQuery<User>() }, "Users optionally filtered"). Please use theUseFilterextension which supports filters referencing service fields. -
IFieldExtension.GetExpressionAndArgumentsnow takes the current GraphQL nodeBaseGraphQLField fieldNodeas an argument.parentNodehas been removed. Access it viafieldNode.ParentNode. -
EntityGraphQL.AspNetpackage dropsnet6.0andnet7.0as targets.EntityGraphQLpackage dropsnet6.0as a target however as it still targetsnetstandard2.1you can still use it with those previous dotnet versions.
Changes
- Partial results support
- #467 - New implementation for handling
asyncfields. See updated docs and use the.ResolveAsync<>()methods when adding fields. - New support for
CancellationToken. ACancellationTokencan be passed into theExecuteRequestAsyncmethod. The token will be checked throughout execution and passed to other async operations. You can use it in.ResolveAsync<MyService, CancellationToken>((context, service, ct) => service.DoSomethingAsync(context.Field, ct))to pass it to yourasyncfields. If you useMapGraphQL()for ASP.NET it will use thecontext.RequestAbortedas the cancellation token. - #469 - Make filter grammar immutable as it should be for performance
- #303 - You can now reference service fields in the
UseFilter/[UseFilter]expression. Like normal the filter will first be applied with non service fields, then applied again with service fields isExecutionOptions.ExecuteServiceFieldsSeparately == true(default). - #396 - Filter expressions now support GraphQL variables using
$variableNamesyntax. This allows parameterized and dynamic filters (e.g.,filter: "name == $searchTerm && age > $minAge"). - Related to #331 and the
followSpec = trueabove, errors and exceptions were refactored internally. Following the GraphQL spec if the core library gets an error it will still return aGraphQLResultwith the errors (and potentially partial results).
Fixes
- #429 Validation attributes now work with
[GraphQLInputType]
Full Changelog: 5.7.1...6.0.0-beta1
5.7.1
Fixes
- #466 Include enum-typed input fields in introspection per GraphQL spec
Full Changelog: 5.7.0...5.7.1
5.7.0
Changes
- QueryInfo Support: Added optional query execution information that can be included in the result extensions. Enable with
ExecutionOptions.IncludeQueryInfo = trueto get metadata about:- Operation type (Query, Mutation, Subscription)
- Operation name
- Types queried and their selected fields
- Total number of types and fields queried
- This is useful for query analysis, debugging, and monitoring GraphQL usage patterns
- Fix #441 (PR #455) - Have your argument class (including an
InputType) class inheritArgumentsTrackeror implementIArgumentsTrackerto be able to tell if a variable is just the dotnet default value or is set from the query (variable or inline) withargs.IsSet. You can also includeIArgumentsTrackeras an argument in your mutations etc. This is useful if you method usings simple arguments e.g.MyMutation(Guid id, string name)vs. a[GraphQLArguments]object. - #461 -
EntityGraphQLEndpointRouteExtensions.MapGraphQLnow supports chunked requests RequiredAuthorizationis not settable allowing you to change or overwrite it after creation. Also now hasClear()methods to remove authentication
Fixes
- Throw error on a query that has fragments with a cycle as per the GraphQL spec and to prevent infinite loops.
- #442 - Fix issue when a service field with a bulk resolver is on a parent field named differently to the dotnet underlying object property
5.6.1
Fixes
- #443 - Allow
*/*&application/*Acceptheaders infollowSpecoption forMapGraphQL - #443 - Allow expected headers to not be listed first when using
followSpecoption forMapGraphQL - Better support for multiple items in a single
Acceptheader when usingfollowSpecoption forMapGraphQL - #449 - Fix issues with self referencing query and connection paging
5.6.0
Changes
- Added additional framework target
net9.0 ResolveWithServiceandResolveWithServicesmethods are now marked obsolete. Please useResolvein the same way- #430 -
MapGraphQLhas new parameterfollowSpecwhich changes the behavior to follow https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md and isfalseby default in v5.x. If set totrueit will follow the spec, the major change being that if the HTTP request was valid you'll get a200status code even if there may be GraphQL errors in the response. Note this will be the default behavior in version v6. - Add
IsNullableto theIFieldinterface to control setting the nullability of the field return type in the schema
Fixes
- #435 - fix
isAny()infilter - Fix issue selecting fields from an object a service field returns where the GraphQL field name differs from the dotnet property name.
Example a field that returns a User type using a service and you are changing the field names in the schema like below
schema.Type<User>().AddField("username", u => u.Name, "Username")- #439 - Fix using fields / properties with key words (
null,true,false) at the start of the name in the filter expressions - Related to #430 - Make sure if the schema says a field is not nullable, that it is not returned as
nullwhen usingnullto exit a mutation or field on error. - Fix issue where an expression extracted from a service field may clash with a existing field name
New Contributors
Full Changelog: 5.5.3...5.6.0
5.5.3
5.5.2
Fixes
- #418 - Fix issue where field expressions using
ctx.Entities.FirstOrDefault(<filter>)(First*,Last*,Single*methods with a filter) would duplicate the filter expression on each execution (e.g. makingctx.Entities.Where(<filter>).Where(<filter>).FirstOrDefault()). This also caused EntityFramework not to use it's cache for the expression - Fix issue with
RequiresAnyRole()being called on a field with multiple roles added them as requiring all those roles vs. any role. This did not effect the[GraphQLAuthorize]attribute
5.5.1
5.5.0
Changes
- Add
IgnoreAttributestoSchemaBuilderOptions- A list of Attribute types which will cause the builder to ignore the field/property when building the schema. These are additional to GraphQLIgnoreAttribute .Resolve<>()method on field changes return type toobject?to avoid warnings when returning a valid nullable service call etc.- Add support for using a
structtype as an object type in the schema, allowing you to query the fields on it. Previously it only worked if you added thestructas a Scalar Type - #419 - Add support for using
isAny([])on nullable types