11# Version history / migration notes
22
3+ ## 8.0.0
4+
5+ ### New features
6+
7+ - Response content type negotiation now properly handles the ` Accept ` header, supporting
8+ ` application/graphql-response+json ` , ` application/json ` , and ` application/graphql+json ` (deprecated).
9+ - Status codes for validation errors are now, by default, determined by the response content type,
10+ and for authentication errors may return a 401 or 403 status code. These changes are pursuant
11+ to the [ GraphQL over HTTP specification] ( https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md ) .
12+ See the breaking changes section below for more information.
13+
14+ ### Breaking changes
15+
16+ - ` GraphQLHttpMiddlewareOptions.ValidationErrorsReturnBadRequest ` is now a nullable boolean where
17+ ` null ` means "use the default behavior". The default behavior is to return a 200 status code
18+ when the response content type is ` application/json ` and a 400 status code otherwise. The
19+ default value for this in v7 was ` true ` ; set this option to retain the v7 behavior.
20+ - Validation errors such as authentication errors may now be returned with a 'preferred' status
21+ code instead of a 400 status code. This occurs when (1) the response would otherwise contain
22+ a 400 status code (e.g. the execution of the document has not yet begun), and (2) all errors
23+ in the response prefer the same status code. For practical purposes, this means that the included
24+ errors triggered by the authorization validation rule will now return 401 or 403 when appropriate.
25+ - The ` SelectResponseContentType ` method now returns a ` MediaTypeHeaderValue ` instead of a string.
26+ - The default response content type is now ` application/graphql-response+json ` (configurable via
27+ ` GraphQLHttpMiddlewareOptions.DefaultResponseContentType ` ), which is the new standard per the
28+ GraphQL over HTTP specification.
29+
30+ ### Other changes
31+
32+ - Added deprecation comments to ` MEDIATYPE_GRAPHQLJSON ` and ` CONTENTTYPE_GRAPHQLJSON ` constants
33+ as ` application/graphql+json ` is being phased out in favor of ` application/graphql-response+json ` .
34+
335## 7.0.0
436
537GraphQL.AspNetCore3 v7 requires GraphQL.NET v8 or newer.
@@ -33,10 +65,6 @@ GraphQL.AspNetCore3 v6 requires GraphQL.NET v8 or newer.
3365
3466### Breaking changes
3567
36- - ` GraphQLHttpMiddlewareOptions.ValidationErrorsReturnBadRequest ` is now a nullable boolean where
37- ` null ` means "use the default behavior". The default behavior is to return a 200 status code
38- when the response content type is ` application/json ` and a 400 status code otherwise. The
39- default value for this in v7 was ` true ` ; set this option to retain the v7 behavior.
4068- The validation rules' signatures have changed slightly due to the underlying changes to the
4169 GraphQL.NET library. Please see the GraphQL.NET v8 migration document for more information.
4270- Cross-site request forgery (CSRF) protection has been enabled for all requests by default.
@@ -46,12 +74,6 @@ GraphQL.AspNetCore3 v6 requires GraphQL.NET v8 or newer.
4674 the ` CsrfProtectionHeaders ` property on the same class. See the readme for more details.
4775- Form POST requests are disabled by default; to enable them, set the ` ReadFormOnPost ` setting
4876 to ` true ` .
49- - Validation errors such as authentication errors may now be returned with a 'preferred' status
50- code instead of a 400 status code. This occurs when (1) the response would otherwise contain
51- a 400 status code (e.g. the execution of the document has not yet begun), and (2) all errors
52- in the response prefer the same status code. For practical purposes, this means that the included
53- errors triggered by the authorization validation rule will now return 401 or 403 when appropriate.
54- - The ` SelectResponseContentType ` method now returns a ` MediaTypeHeaderValue ` instead of a string.
5577- The ` AuthorizationVisitorBase.GetRecursivelyReferencedUsedFragments ` method has been removed as
5678 ` ValidationContext ` now provides an overload to ` GetRecursivelyReferencedFragments ` which will only
5779 return fragments in use by the specified operation.
0 commit comments