Skip to content
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
4 changes: 4 additions & 0 deletions src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1945,6 +1945,7 @@ pub struct __DirectiveBuilder {
#[allow(dead_code)]
#[serde(untagged)]
pub enum __SchemaField {
Description,
Types(Vec<__TypeBuilder>),
QueryType(__TypeBuilder),
MutationType(Option<__TypeBuilder>),
Expand All @@ -1961,6 +1962,7 @@ pub struct __SchemaSelection {

#[derive(Clone)]
pub struct __SchemaBuilder {
pub description: String,
pub selections: Vec<__SchemaSelection>,
}

Expand Down Expand Up @@ -2516,6 +2518,7 @@ impl __Schema {
builder_fields.push(__SchemaSelection {
alias: alias_or_name(&selection_field),
selection: match f.name().as_str() {
"description" => __SchemaField::Description,
"types" => {
let builders = self
.types()
Expand Down Expand Up @@ -2601,6 +2604,7 @@ impl __Schema {
}

Ok(__SchemaBuilder {
description: "Represents the GraphQL schema of the database".to_string(),
selections: builder_fields,
})
}
Expand Down
3 changes: 3 additions & 0 deletions src/transpile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,9 @@ impl Serialize for __SchemaBuilder {

for selection in &self.selections {
match &selection.selection {
__SchemaField::Description => {
map.serialize_entry(&selection.alias, &self.description)?;
}
__SchemaField::Types(type_builders) => {
map.serialize_entry(&selection.alias, &type_builders)?;
}
Expand Down
105 changes: 105 additions & 0 deletions test/expected/issue_581_missing_desc_on_schema.out

Large diffs are not rendered by default.

102 changes: 102 additions & 0 deletions test/sql/issue_581_missing_desc_on_schema.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
begin;

select graphql.resolve($$
query IntrospectionQuery {
__schema {
description
queryType { name }
mutationType { name }
subscriptionType { name }
types {
...FullType
}
directives {
name
description

locations
args(includeDeprecated: true) {
...InputValue
}
}
}
}

fragment FullType on __Type {
kind
name
description

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

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

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
}
}
}
}
}
}
}
}
$$, NULL, 'IntrospectionQuery');

rollback;
Loading