Skip to content

Commit

Permalink
Respect UseXmlDocumentation with Schema.Create (#897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel Sampson authored and michaelstaib committed Jul 7, 2019
1 parent 192307d commit 6cc1ca5
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
15 changes: 15 additions & 0 deletions src/Core/Types.Tests/Types/ObjectTypeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1322,6 +1322,21 @@ public void CreateObjectTypeWithXmlDocumentation_IgnoreXmlDocs()
schema.ToString().MatchSnapshot();
}

[Fact]
public void CreateObjectTypeWithXmlDocumentation_IgnoreXmlDocs_SchemaCreate()
{
// arrange
// act
ISchema schema = Schema.Create(c =>
{
c.RegisterQueryType<QueryWithDocumentation>();
c.Options.UseXmlDocumentation = false;
});

// assert
schema.ToString().MatchSnapshot();
}

[Fact]
public void Field_Is_Missing_Type_Throws_SchemaException()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
schema {
query: QueryWithDocumentation
}

type QueryWithDocumentation {
foo(bar: String): String
}

"The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text."
scalar String
3 changes: 2 additions & 1 deletion src/Core/Types/Configuration/SchemaOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ public static SchemaOptions FromOptions(IReadOnlySchemaOptions options)
QueryTypeName = options.QueryTypeName,
MutationTypeName = options.MutationTypeName,
SubscriptionTypeName = options.SubscriptionTypeName,
StrictValidation = options.StrictValidation
StrictValidation = options.StrictValidation,
UseXmlDocumentation = options.UseXmlDocumentation
};
}
}
Expand Down

0 comments on commit 6cc1ca5

Please sign in to comment.