Skip to content

extend introspection schema to include oneOf and specifiedByURL #501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
query IntrospectionQueryWithIsOneOfSpecifiedByURL {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullTypeWithisOneOfSpecifiedByURL
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}

fragment FullTypeWithisOneOfSpecifiedByURL on __Type {
kind
name
description
isOneOf
specifiedByURL
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
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
query IntrospectionQueryWithIsOneOf {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullTypeWithisOneOf
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}

fragment FullTypeWithisOneOf on __Type {
kind
name
description
isOneOf
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
}
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
query IntrospectionQueryWithSpecifiedBy {
__schema {
queryType {
name
}
mutationType {
name
}
subscriptionType {
name
}
types {
...FullTypeWithSpecifiedBy
}
directives {
name
description
locations
args {
...InputValue
}
}
}
}

fragment FullTypeWithSpecifiedBy on __Type {
kind
name
description
specifiedByURL
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
}
}
}
}
}
}
}
}
8 changes: 8 additions & 0 deletions graphql_client_cli/src/graphql/introspection_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ type __Type {

# NON_NULL and LIST only
ofType: __Type

# may be non-null for custom SCALAR, otherwise null.
# https://spec.graphql.org/draft/#sec-Scalars.Custom-Scalars
specifiedByURL: String
specifiedBy: String

# should be non-null for INPUT_OBJECT only
isOneOf: Boolean
}

type __Field {
Expand Down
41 changes: 41 additions & 0 deletions graphql_client_cli/src/introspection_queries.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use graphql_client::GraphQLQuery;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/graphql/introspection_schema.graphql",
query_path = "src/graphql/introspection_query.graphql",
response_derives = "Serialize",
variable_derives = "Deserialize"
)]
#[allow(dead_code)]
pub struct IntrospectionQuery;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/graphql/introspection_schema.graphql",
query_path = "src/graphql/introspection_query_with_is_one_of.graphql",
response_derives = "Serialize",
variable_derives = "Deserialize"
)]
#[allow(dead_code)]
pub struct IntrospectionQueryWithIsOneOf;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/graphql/introspection_schema.graphql",
query_path = "src/graphql/introspection_query_with_specified_by.graphql",
response_derives = "Serialize",
variable_derives = "Deserialize"
)]
#[allow(dead_code)]
pub struct IntrospectionQueryWithSpecifiedBy;

#[derive(GraphQLQuery)]
#[graphql(
schema_path = "src/graphql/introspection_schema.graphql",
query_path = "src/graphql/introspection_query_with_isOneOf_specifiedByUrl.graphql",
response_derives = "Serialize",
variable_derives = "Deserialize"
)]
#[allow(dead_code)]
pub struct IntrospectionQueryWithIsOneOfSpecifiedByURL;
Loading