GraphQL.IntrospectionModel 0.0.22

dotnet add package GraphQL.IntrospectionModel --version 0.0.22                
NuGet\Install-Package GraphQL.IntrospectionModel -Version 0.0.22                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GraphQL.IntrospectionModel" Version="0.0.22" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GraphQL.IntrospectionModel --version 0.0.22                
#r "nuget: GraphQL.IntrospectionModel, 0.0.22"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GraphQL.IntrospectionModel as a Cake Addin
#addin nuget:?package=GraphQL.IntrospectionModel&version=0.0.22

// Install GraphQL.IntrospectionModel as a Cake Tool
#tool nuget:?package=GraphQL.IntrospectionModel&version=0.0.22                

graphql-introspection-model

<a href="https://www.buymeacoffee.com/sungam3r" target="_blank"><img src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/orange_img.png" alt="Buy Me A Coffee" style="height: auto !important;width: auto !important;" ></a>

License

codecov Nuget NuGet

GitHub Release Date GitHub commits since latest release (by date) Size

GitHub contributors Activity Activity Activity

Run unit tests Publish preview to GitHub registry Publish release to Nuget registry CodeQL analysis

Types for GraphQL introspection model. Used by graphql-sdl-exporter.

A GraphQL server supports introspection over its schema. This schema is queried using GraphQL itself, creating a powerful platform for tool‐building.

Here's what a "classic" introspection query looks like:

query IntrospectionQuery {
  __schema {
    queryType { name }
    mutationType { name }
    subscriptionType { name }
    types {
      ...FullType
    }
    directives {
      name
      description
      locations
      args {
        ...InputValue
      }
    }
  }
}

fragment FullType on __Type {
  kind
  name
  description
  fields(includeDeprecated: true) {
    name
    description
    args {
      ...InputValue
    }
    type {
      ...TypeRef
    }
    isDeprecated
    deprecationReason
  }
  inputFields {
    ...InputValue
  }
  interfaces {
    ...TypeRef
  }
  enumValues(includeDeprecated: true) {
    name
    description
    isDeprecated
    deprecationReason
  }
  possibleTypes {
    ...TypeRef
  }
}

fragment InputValue on __InputValue {
  name
  description
  type { ...TypeRef }
  defaultValue
}

fragment TypeRef on __Type {
  kind
  name
  ofType {
    kind
    name
    ofType {
      kind
      name
      ofType {
        kind
        name
        ofType {
          kind
          name
          ofType {
            kind
            name
            ofType {
              kind
              name
              ofType {
                kind
                name
              }
            }
          }
        }
      }
    }
  }
}

The result of this query (like all other GraphQL queries) is JSON. You can deal with it directly or deserialize it into some data structures. Such data structures are provided by this repository. The top level type is GraphQLResponse. After deserialization JSON into the GraphQLResponse (or after creating GraphQLSchema in any other way), it can be transformed into AST representation and then printed by SDLPrinter from GraphQL-Parser nuget package.

Example of deserializing introspection response
using System.Text.Json;

string text = ...; // from HTTP introspection response
var response = JsonSerializer.Deserialize<GraphQLResponse>(text, new JsonSerializerOptions
{
    PropertyNameCaseInsensitive = true,
    Converters = { new JsonStringEnumConverter() }
});
var schema = response.Data.__Schema; // note that Data may be null, so check response.Errors 
Example of printing GraphQLSchema into SDL
GraphQLSchema schema = ...;

var converter = new ASTConverter();
var document = converter.ToDocument(schema);
var printer = new SDLPrinter(options);
var sdl = printer.Print(document);

// or use one-line extension method
var sdl = schema.Print();

GraphQL has its own language to write GraphQL schemas, SDL - Schema Definition Language. SDL is simple and intuitive to use while being extremely powerful and expressive. Some examples of SDL documents can be found in graphql-sdl-exporter project.

Many types in this project implement the IHasDirectives interface. It serves to obtain information about the directives applied to the element. The official specification does not describe such a possibility, although discussions are underway to expand the specification to add this feature. graphql-sdl-exporter can get information about directives if the server supports this feature.

Variations of introspection query

This repo provides 4 variations of introspection query:

  1. Classic - "classic" introspection query provided above (without exposing applied directives). It conforms to the latest release version of the spec.
  1. ClassicDraft - the same as "classic" + deprecations for input values. See PR for more info. It conforms to the prerelease (working draft) version of the spec.

  2. Modern - modified "classic" introspection query, in which the directives applied to the schema elements are exposed. It requires GraphQL server to support this feature. See GraphQL.NET as an example of such a server.

  3. ModernDraft - the same as "modern" + deprecations for input values. This is the most advanced query among all available.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on GraphQL.IntrospectionModel:

Package Downloads
Theauxm.GraphQL.Client

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.22 5,067 12/12/2023
0.0.21 523 4/21/2023
0.0.20 1,152 4/21/2023
0.0.19 203 4/21/2023
0.0.18 185 4/21/2023
0.0.17 224 4/14/2023
0.0.16 862 12/2/2022
0.0.15 2,591 3/1/2022
0.0.14 1,150 8/2/2021
0.0.13 1,374 4/22/2021
0.0.12 373 4/20/2021
0.0.11 340 4/15/2021
0.0.10 438 3/24/2021
0.0.9 734 10/25/2020
0.0.7 417 10/25/2020
0.0.5 431 9/10/2020
0.0.4 525 7/6/2020
0.0.3 497 2/4/2020
0.0.2 532 12/9/2019
0.0.1 514 12/9/2019