Exemplo n.º 1
0
        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();
        }
Exemplo n.º 2
0
        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();
        }
Exemplo n.º 3
0
        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());
        }