Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include error documentation and result documentation into the GraphQL…
… description. (#1524, #1516) Co-authored-by: Moritz Brandes <mb@grannyandsmith.com> Co-authored-by: Michael Staib <michael@chillicream.com>
- Loading branch information
1 parent
a9fe2a6
commit 94e0186
Showing
17 changed files
with
506 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 45 additions & 3 deletions
48
src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/IDocumentationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,54 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
#nullable enable | ||
|
||
namespace HotChocolate.Types.Descriptors | ||
{ | ||
/// <summary> | ||
/// The documentation provider is able to extract GraphQL type system | ||
/// documentation from the associated .NET type system. | ||
/// </summary> | ||
public interface IDocumentationProvider | ||
{ | ||
string GetSummary(Type type); | ||
string GetSummary(MemberInfo member); | ||
string GetSummary(ParameterInfo parameter); | ||
/// <summary> | ||
/// Gets the documentation for a GraphQL type from the | ||
/// associated <see cref="Type" />. | ||
/// </summary> | ||
/// <param name="type"> | ||
/// The type from which the documentation shall be extracted. | ||
/// </param> | ||
/// <returns> | ||
/// Returns a markdown string (https://commonmark.org) | ||
/// describing the GraphQL type. | ||
/// </returns> | ||
string? GetDescription(Type type); | ||
|
||
/// <summary> | ||
/// Gets the documentation for a GraphQL input-, output-field or | ||
/// directive argument from the associated <see cref="MemberInfo" />. | ||
/// </summary> | ||
/// <param name="member"> | ||
/// The member from which the documentation shall be extracted. | ||
/// </param> | ||
/// <returns> | ||
/// Returns a markdown string (https://commonmark.org) | ||
/// describing the GraphQL input-, output-field or | ||
/// directive argument, | ||
/// </returns> | ||
string? GetDescription(MemberInfo member); | ||
|
||
/// <summary> | ||
/// Gets the documentation for a GraphQL field argument from the | ||
/// associated <see cref="ParameterInfo" />. | ||
/// </summary> | ||
/// <param name="parameter"> | ||
/// The parameter from which the documentation shall be extracted. | ||
/// </param> | ||
/// <returns> | ||
/// Returns a markdown string (https://commonmark.org) | ||
/// describing the GraphQL field argument. | ||
/// </returns> | ||
string? GetDescription(ParameterInfo parameter); | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
src/HotChocolate/Core/src/Types/Types/Descriptors/Conventions/NoopDocumentationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Reflection; | ||
|
||
#nullable enable | ||
|
||
namespace HotChocolate.Types.Descriptors | ||
{ | ||
internal sealed class NoopDocumentationProvider | ||
: IDocumentationProvider | ||
{ | ||
public string? GetDescription(Type type) => null; | ||
|
||
public string? GetDescription(MemberInfo member) => null; | ||
|
||
public string? GetDescription(ParameterInfo parameter) => null; | ||
} | ||
} |
Oops, something went wrong.