ExposeData when enabled sets the extension's data property to equal the data within the error'sĭata property.That has an inner exception of type ArgumentNullException would contain a codes property So an ExecutionError with a code of INVALID_FORMAT UPPER_CASE and removing the "Extension" suffix). The error's Code property, if any, and the type name of inner exceptions (after being converted to ExposeCodes when enabled sets the extensions's codes property to equal a list containing both.ExposeCode when enabled sets the extensions's code property to equal the error's Code.ToString() method, which includes a stack trace. ExposeExceptionStackTrace when enabled sets the message property for errors to equal theĮxception's.IErrorInfoProvider) contains 5 properties to control serialization behavior: The ErrorInfoProvider class (default implementation of To the constructor of the document writer. Serialization of ExecutionErrors into the resulting json data by providing an IErrorInfoProvider The GraphQL spec allows for four properties to be returned within eachĮrror: message, locations, path, and extensions. WriteToStringAsync (result ) Error Serialization Within your dependency injection framework, if applicable. This class is designed to be registered as a singleton Handles constructing the options, registering the converter, and serializing a specifiedĮxecutionResult to a data stream. To assist, a DocumentWriter class is provided with a single method, WriteAsync, which The converter can be registered within an instance of JsonSerializerOptions so that serializing anĮxecutionResult produces the proper output. Serialization of a ExecutionResult object is handled by ExecutionResultJsonConverter which accepts in itsĬonstructor an instance of IErrorInfoProvider (see Error Serialization below). A sample of the required configuration is below: Reading and writing of the underlying stream. Significant when hosting the service via ASP.NET Core, as it is required to deliberately allow synchronous Helper actually performs synchronous calls on the underlying stream when writing the JSON output. Due to this reason, the async GraphQL.NewtonsoftJson serialization Serialization or deserialization methods. First, the Newtonsoft.Json library does not provide asynchronous There are two notableĭifferences between the two serialization engines. These two projects have very similar classes and extension methods available. GraphQL.NewtonsoftJson, for use with the Newtonsoft.Json library.GraphQL.SystemTextJson, for use with the library, and.Request or response format, but it is common to do so. Two libraries are available for assistance deserializing JSON-formatted GraphQL requests,Īnd serializing GraphQL responses in a JSON format.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |