{"id":17062106,"url":"https://github.com/sungam3r/graphql-introspection-model","last_synced_at":"2025-10-07T12:09:24.386Z","repository":{"id":40381371,"uuid":"226851417","full_name":"sungam3r/graphql-introspection-model","owner":"sungam3r","description":"Types for GraphQL introspection model.","archived":false,"fork":false,"pushed_at":"2025-05-05T19:13:23.000Z","size":301,"stargazers_count":5,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-09-28T00:39:45.151Z","etag":null,"topics":["graphql","introspection"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sungam3r.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["sungam3r"],"custom":["https://www.buymeacoffee.com/sungam3r","https://paypal.me/sungam3r"]}},"created_at":"2019-12-09T11:05:24.000Z","updated_at":"2025-02-16T17:55:05.000Z","dependencies_parsed_at":"2023-10-11T11:15:16.767Z","dependency_job_id":"9af41269-82d8-485e-b549-48c635cefb4d","html_url":"https://github.com/sungam3r/graphql-introspection-model","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/sungam3r/graphql-introspection-model","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungam3r%2Fgraphql-introspection-model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungam3r%2Fgraphql-introspection-model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungam3r%2Fgraphql-introspection-model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungam3r%2Fgraphql-introspection-model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sungam3r","download_url":"https://codeload.github.com/sungam3r/graphql-introspection-model/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sungam3r%2Fgraphql-introspection-model/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278771426,"owners_count":26042973,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","introspection"],"created_at":"2024-10-14T10:49:13.472Z","updated_at":"2025-10-07T12:09:24.328Z","avatar_url":"https://github.com/sungam3r.png","language":"C#","funding_links":["https://github.com/sponsors/sungam3r","https://www.buymeacoffee.com/sungam3r","https://paypal.me/sungam3r"],"categories":[],"sub_categories":[],"readme":"# graphql-introspection-model\n\n\u003ca href=\"https://www.buymeacoffee.com/sungam3r\" target=\"_blank\"\u003e\u003cimg 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;\" \u003e\u003c/a\u003e\n\n![License](https://img.shields.io/github/license/sungam3r/graphql-introspection-model)\n\n[![codecov](https://codecov.io/gh/sungam3r/graphql-introspection-model/graph/badge.svg?token=I98DQMW5EJ)](https://codecov.io/gh/sungam3r/graphql-introspection-model)\n[![Nuget](https://img.shields.io/nuget/dt/GraphQL.IntrospectionModel)](https://www.nuget.org/packages/GraphQL.IntrospectionModel)\n[![NuGet](https://img.shields.io/nuget/v/GraphQL.IntrospectionModel)](https://www.nuget.org/packages/GraphQL.IntrospectionModel)\n\n[![GitHub Release Date](https://img.shields.io/github/release-date/sungam3r/graphql-introspection-model?label=released)](https://github.com/sungam3r/graphql-introspection-model/releases)\n[![GitHub commits since latest release (by date)](https://img.shields.io/github/commits-since/sungam3r/graphql-introspection-model/latest?label=new+commits)](https://github.com/sungam3r/graphql-introspection-model/commits/master)\n![Size](https://img.shields.io/github/repo-size/sungam3r/graphql-introspection-model)\n\n[![GitHub contributors](https://img.shields.io/github/contributors/sungam3r/graphql-introspection-model)](https://github.com/sungam3r/graphql-introspection-model/graphs/contributors)\n![Activity](https://img.shields.io/github/commit-activity/w/sungam3r/graphql-introspection-model)\n![Activity](https://img.shields.io/github/commit-activity/m/sungam3r/graphql-introspection-model)\n![Activity](https://img.shields.io/github/commit-activity/y/sungam3r/graphql-introspection-model)\n\n[![Run unit tests](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/test.yml/badge.svg)](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/test.yml)\n[![Publish preview to GitHub registry](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/publish-preview.yml/badge.svg)](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/publish-preview.yml)\n[![Publish release to Nuget registry](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/publish-release.yml/badge.svg)](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/publish-release.yml)\n[![CodeQL analysis](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/sungam3r/graphql-introspection-model/actions/workflows/codeql-analysis.yml)\n\nTypes for GraphQL [introspection](https://graphql.github.io/graphql-spec/October2021/#sec-Introspection) model. Used by [graphql-sdl-exporter](https://github.com/sungam3r/graphql-sdl-exporter).\n\nA GraphQL server supports introspection over its schema. This schema is queried using GraphQL itself, creating a powerful\nplatform for tool‐building.\n\nHere's what a \"classic\" introspection query looks like:\n```graphql\nquery IntrospectionQuery {\n  __schema {\n    queryType { name }\n    mutationType { name }\n    subscriptionType { name }\n    types {\n      ...FullType\n    }\n    directives {\n      name\n      description\n      locations\n      args {\n        ...InputValue\n      }\n    }\n  }\n}\n\nfragment FullType on __Type {\n  kind\n  name\n  description\n  fields(includeDeprecated: true) {\n    name\n    description\n    args {\n      ...InputValue\n    }\n    type {\n      ...TypeRef\n    }\n    isDeprecated\n    deprecationReason\n  }\n  inputFields {\n    ...InputValue\n  }\n  interfaces {\n    ...TypeRef\n  }\n  enumValues(includeDeprecated: true) {\n    name\n    description\n    isDeprecated\n    deprecationReason\n  }\n  possibleTypes {\n    ...TypeRef\n  }\n}\n\nfragment InputValue on __InputValue {\n  name\n  description\n  type { ...TypeRef }\n  defaultValue\n}\n\nfragment TypeRef on __Type {\n  kind\n  name\n  ofType {\n    kind\n    name\n    ofType {\n      kind\n      name\n      ofType {\n        kind\n        name\n        ofType {\n          kind\n          name\n          ofType {\n            kind\n            name\n            ofType {\n              kind\n              name\n              ofType {\n                kind\n                name\n              }\n            }\n          }\n        }\n      }\n    }\n  }\n}\n```\n\nThe result of this query (like all other GraphQL queries) is JSON. You can deal with it directly or deserialize it into some data structures.\nSuch data structures are provided by this repository. The top level type is [`GraphQLResponse`](src/GraphQL.IntrospectionModel/GraphQLResponse.cs).\nAfter deserialization JSON into the `GraphQLResponse` (or after creating `GraphQLSchema` in any other way), it can be transformed into AST\nrepresentation and then printed by `SDLPrinter` from [GraphQL-Parser](https://github.com/graphql-dotnet/parser) nuget package.\n\n#### Example of deserializing introspection response\n\n```csharp\nusing System.Text.Json;\n\nstring text = ...; // from HTTP introspection response\nvar response = JsonSerializer.Deserialize\u003cGraphQLResponse\u003e(text, new JsonSerializerOptions\n{\n    PropertyNameCaseInsensitive = true,\n    Converters = { new JsonStringEnumConverter() }\n});\nvar schema = response.Data.__Schema; // note that Data may be null, so check response.Errors \n```\n\n#### Example of printing `GraphQLSchema` into SDL\n\n```csharp\nGraphQLSchema schema = ...;\n\nvar converter = new ASTConverter();\nvar document = converter.ToDocument(schema);\nvar printer = new SDLPrinter(options);\nvar sdl = printer.Print(document);\n\n// or use one-line extension method\nvar sdl = schema.Print();\n```\n\nGraphQL has its own language to write GraphQL schemas, [SDL](https://graphql.github.io/graphql-spec/October2021/#sec-Type-System) - Schema Definition Language.\nSDL is simple and intuitive to use while being extremely powerful and expressive. Some examples of SDL documents can be found in [graphql-sdl-exporter](https://github.com/sungam3r/graphql-sdl-exporter/tree/master/samples) project.\n\nMany types in this project implement the [`IHasDirectives`](src/GraphQL.IntrospectionModel/IHasDirectives.cs) interface. It serves to obtain information\nabout the directives applied to the element. The [official specification](https://graphql.github.io/graphql-spec/October2021) does not describe such a possibility,\nalthough [discussions](https://github.com/graphql/graphql-spec/issues/300) are underway to expand the specification to add this feature.\n[graphql-sdl-exporter](https://github.com/sungam3r/graphql-sdl-exporter/tree/master/samples) can get information about directives if the server\nsupports this feature.\n\n#### Variations of introspection query\n\nThis repo provides 4 variations of [introspection query](src/GraphQL.IntrospectionModel/IntrospectionQuery.cs):\n\n1. **Classic** - \"classic\" introspection query provided above (without exposing applied directives).\nIt conforms to the latest release version of the spec.\n\n2) **ClassicDraft** - the same as \"classic\" + deprecations for input values.\nSee [PR](https://github.com/graphql/graphql-spec/pull/805) for more info. It conforms to the prerelease\n(working draft) version of the spec.\n\n3) **Modern** - modified \"classic\" introspection query, in which the directives applied to the schema\nelements are exposed. It requires GraphQL server to support this feature.\nSee [GraphQL.NET](https://graphql-dotnet.github.io/docs/getting-started/directives/#directives-and-introspection)\nas an example of such a server.\n\n4) **ModernDraft** - the same as \"modern\" + deprecations for input values. This is the most advanced\nquery among all available.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungam3r%2Fgraphql-introspection-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsungam3r%2Fgraphql-introspection-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsungam3r%2Fgraphql-introspection-model/lists"}