public void DeserializeStarWarsIntrospectionResult() { // arrange string json = FileResource.Open("StarWarsIntrospectionResult.json"); IntrospectionResult result = JsonSerializer.Deserialize <IntrospectionResult>( json, IntrospectionClient.SerializerOptions); // act DocumentNode schema = IntrospectionDeserializer.Deserialize(result); // assert schema.ToString(true).MatchSnapshot(); }
public void DeserializeIntrospectionWithIntDefaultValues() { // arrange string json = FileResource.Open("IntrospectionWithDefaultValues.json"); IntrospectionResult result = JsonSerializer.Deserialize <IntrospectionResult>( json, IntrospectionClient.SerializerOptions); // act DocumentNode schema = IntrospectionDeserializer.Deserialize(result); // assert SchemaSyntaxSerializer.Serialize(schema).MatchSnapshot(); }
public async Task <DocumentNode> DownloadSchemaAsync( HttpClient client, CancellationToken cancellationToken = default) { if (client is null) { throw new ArgumentNullException(nameof(client)); } ISchemaFeatures features = await GetSchemaFeaturesAsync( client, cancellationToken) .ConfigureAwait(false); HttpQueryRequest request = IntrospectionQueryHelper.CreateIntrospectionQuery(features); IntrospectionResult result = await ExecuteIntrospectionAsync( client, request, cancellationToken) .ConfigureAwait(false); EnsureNoGraphQLErrors(result); return(IntrospectionDeserializer.Deserialize(result).RemoveBuiltInTypes()); }