Skip to content

Commit

Permalink
Fixes stitching issues when fetching from downstream services. (#2511)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstaib committed Oct 28, 2020
1 parent f70c344 commit 4d87c53
Show file tree
Hide file tree
Showing 52 changed files with 340 additions and 139 deletions.
2 changes: 1 addition & 1 deletion .build/Helpers.cs
Expand Up @@ -10,7 +10,7 @@ class Helpers
static readonly string[] _directories = new string[]
{
"GreenDonut",
Path.Combine("HotChocolate", "ApolloFederation"),
// Path.Combine("HotChocolate", "ApolloFederation"),
Path.Combine("HotChocolate", "AspNetCore"),
Path.Combine("HotChocolate", "Core"),
Path.Combine("HotChocolate", "Language"),
Expand Down
18 changes: 17 additions & 1 deletion ErrorCodes.md
Expand Up @@ -4,4 +4,20 @@
| HC0002 | Scalars | Either the syntax node is invalid when parsing the literal or the syntax node value has an invalid format. |
| HC0003 | Apollo Federation | The key attribute is used on the type level without specifying the fieldset. |
| HC0004 | Apollo Federation | The provides attribute is used and the fieldset is set to `null` or `string.Empty`. |
| HC0005 | Apollo Federation | The requires attribute is used and the fieldset is set to `null` or `string.Empty`. |
| HC0005 | Apollo Federation | The requires attribute is used and the fieldset is set to `null` or `string.Empty`. |
| HC0006 | Schema Stitching | The HTTP request failed. |
| HC0007 | Schema Stitching | Unknown error happened while fetching from a downstream service. |
| HC0008 | Execution | An unexpected error happened during execution task processing. |
| HC0009 | Server | The GraphQL request structure is invalid. |
| HC0010 | Server | The request is larger then maximum allowed request size. |
| HC0011 | Server | The GraphQL request has syntax errors. |
| HC0012 | Server | Unexpected request parser error. |
| HC0013 | Server | The query and the id is missing from the GraphQL request. |
| HC0014 | Execution | The GraphQL document has syntax errors. |
| HC0015 | Execution | No query document was provided and the provided query id is unknown. |
| HC0016 | Execution | Variable `xyz` got an invalid value. |
| HC0017 | Execution | Variable `xyz` is not an input type. |
| HC0018 | Execution | Variable `xyz` is required. |



Expand Up @@ -8,7 +8,7 @@
<PackageId>HotChocolate.AspNetCore.Authorization</PackageId>
<AssemblyName>HotChocolate.AspNetCore.Authorization</AssemblyName>
<RootNamespace>HotChocolate.AspNetCore.Authorization</RootNamespace>
<Description>Contains the Hot Chocolate GraphQL middleware for ASP .Net core.</Description>
<Description>This package contains the ASP.NET Core authorization integrations for Hot Chocolate.</Description>
</PropertyGroup>

<ItemGroup>
Expand Down
Expand Up @@ -4,7 +4,7 @@
<PackageId>HotChocolate.AspNetCore</PackageId>
<AssemblyName>HotChocolate.AspNetCore</AssemblyName>
<RootNamespace>HotChocolate.AspNetCore</RootNamespace>
<Description>Contains the Hot Chocolate GraphQL middleware for ASP .Net core.</Description>
<Description>This package contains the GraphQL ASP.NET Core middleware for Hot Chocolate. Moreover, this package includes the Banana Cake Pop middleware, which provides you with our beloved GraphQL IDE middleware.</Description>
</PropertyGroup>

<ItemGroup>
Expand All @@ -22,6 +22,18 @@
<ItemGroup>
<None Remove="Resources\**\*" />
<EmbeddedResource Include="Resources\**\*" />
<EmbeddedResource Update="Properties\AspNetCoreResources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>AspNetCoreResources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\AspNetCoreResources.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>AspNetCoreResources.resx</DependentUpon>
</Compile>
</ItemGroup>

</Project>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>

<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">

</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="ThrowHelper_DefaultHttpRequestParser_RequestIsEmpty" xml:space="preserve">
<value>The GraphQL request is empty.</value>
</data>
<data name="ThrowHelper_DefaultHttpRequestParser_QueryAndIdMissing" xml:space="preserve">
<value>Either the parameter query or the parameter id has to be set.</value>
</data>
<data name="ThrowHelper_DefaultHttpRequestParser_MaxRequestSizeExceeded" xml:space="preserve">
<value>Max GraphQL request size reached.</value>
</data>
<data name="ThrowHelper_DataStartMessageHandler_RequestTypeNotSupported" xml:space="preserve">
<value>The response type is not supported.</value>
</data>
</root>
@@ -1,5 +1,6 @@
using System;
using HotChocolate.Language;
using static HotChocolate.AspNetCore.Properties.AspNetCoreResources;

namespace HotChocolate.AspNetCore.Utilities
{
Expand All @@ -8,16 +9,17 @@ internal static class ThrowHelper
public static GraphQLRequestException DefaultHttpRequestParser_QueryAndIdMissing() =>
new GraphQLRequestException(
ErrorBuilder.New()
.SetMessage("Either the parameter query or id has to be set.")
.SetMessage(ThrowHelper_DefaultHttpRequestParser_QueryAndIdMissing)
.SetCode(ErrorCodes.Server.QueryAndIdMissing)
.Build());

public static GraphQLRequestException DefaultHttpRequestParser_SyntaxError(
SyntaxException ex) =>
new GraphQLRequestException(
ErrorBuilder.New()
.SetMessage(ex.Message)
.SetCode(ErrorCodes.Execution.SyntaxError)
.AddLocation(ex.Line, ex.Column)
.SetCode(ErrorCodes.Server.SyntaxError)
.Build());

public static GraphQLRequestException DefaultHttpRequestParser_UnexpectedError(
Expand All @@ -26,23 +28,24 @@ internal static class ThrowHelper
ErrorBuilder.New()
.SetMessage(ex.Message)
.SetException(ex)
.SetCode(ErrorCodes.Server.UnexpectedRequestParserError)
.Build());

public static GraphQLRequestException DefaultHttpRequestParser_RequestIsEmpty() =>
new GraphQLRequestException(
ErrorBuilder.New()
.SetMessage("The GraphQL request is empty.")
.SetMessage(ThrowHelper_DefaultHttpRequestParser_RequestIsEmpty)
.SetCode(ErrorCodes.Server.RequestInvalid)
.Build());

public static GraphQLRequestException DefaultHttpRequestParser_MaxRequestSizeExceeded() =>
new GraphQLRequestException(
ErrorBuilder.New()
.SetMessage("Max GraphQL request size reached.")
.SetMessage(ThrowHelper_DefaultHttpRequestParser_MaxRequestSizeExceeded)
.SetCode(ErrorCodes.Server.MaxRequestSize)
.Build());

public static NotSupportedException DataStartMessageHandler_RequestTypeNotSupported() =>
new NotSupportedException("The response type is not supported.");
new NotSupportedException(ThrowHelper_DataStartMessageHandler_RequestTypeNotSupported);
}
}
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_NON_NULL_VIOLATION",
"code": "HC0018",
"variable": "ep"
}
}
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -6,7 +6,7 @@
{
"message": "The GraphQL batch request has no elements.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -6,7 +6,7 @@
{
"message": "The GraphQL batch request has no elements.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -6,7 +6,7 @@
{
"message": "The GraphQL batch request has no elements.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -6,7 +6,7 @@
{
"message": "The GraphQL batch request has no elements.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -4,7 +4,10 @@
"Data": null,
"Errors": [
{
"message": "The GraphQL request is empty."
"message": "The GraphQL request is empty.",
"extensions": {
"code": "HC0012"
}
}
],
"Extensions": null
Expand Down
Expand Up @@ -7,7 +7,7 @@
{
"message": "Invalid GraphQL Request.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -7,7 +7,7 @@
{
"message": "Invalid GraphQL Request.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -7,7 +7,7 @@
{
"message": "Invalid GraphQL Request.",
"extensions": {
"code": "INVALID_REQUEST"
"code": "HC0009"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_NON_NULL_VIOLATION",
"code": "HC0018",
"variable": "ep"
}
}
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down
Expand Up @@ -12,7 +12,7 @@
}
],
"extensions": {
"code": "EXEC_SYNTAX_ERROR"
"code": "HC0011"
}
}
],
Expand Down

0 comments on commit 4d87c53

Please sign in to comment.