-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
GraphQL 4 #9087
Merged
Merged
GraphQL 4 #9087
Changes from 32 commits
Commits
Show all changes
43 commits
Select commit
Hold shift + click to select a range
738f448
GraphQL 4
agriffard f42ac11
started on dataloaders, removed no longer required serviceprovider on…
carlwoodhouse f2fdd21
updated some more requestservices references
carlwoodhouse a4c54b7
few type fixes
carlwoodhouse 4d80c30
More fixes
agriffard 58330aa
fix newtonsoft conflicting reference
carlwoodhouse b86b539
More fixes
agriffard 80c983b
improving middleware
carlwoodhouse b41bdb3
merge
carlwoodhouse 782f516
actually fixed one test :P
carlwoodhouse 5851eb1
fixed some more tests
carlwoodhouse ee07c35
.
carlwoodhouse 1501f38
fixed some of the blog integration tests
carlwoodhouse 79d6ce2
fix some tests
carlwoodhouse c97640f
fixed more tests
carlwoodhouse 257dc55
ResolvedType
agriffard 78d0b52
fix unit tests
carlwoodhouse 54b0195
merge
carlwoodhouse 6bb635b
Merge branch 'dev' into ag/graphql4
sebastienros 3f93e55
Merge branch 'dev' into ag/graphql4
agriffard 2064734
GraphQL 4.3.0
agriffard a7fde44
GraphQL 4.4.0
agriffard c0d9715
Merge branch 'dev' into ag/graphql4
agriffard e193d32
Merge branch 'dev' into ag/graphql4 and use version 4.5.0
agriffard a37ffaa
Merge branch 'dev' into ag/graphql4
agriffard 1757f54
graphql 4.6.1
carlwoodhouse d9a79fe
Merge branch 'main' into ag/graphql4
carlwoodhouse 48bfb93
microsoftdi package ref issue
carlwoodhouse c68e6ba
fix permissions
carlwoodhouse 8e81024
merge main
carlwoodhouse cad6999
fix dynamic fields
carlwoodhouse cc3eb91
Update graphql.net to 4.6.1 (#10782)
MikeKry 760d279
Merge branch 'main' into ag/graphql4
agriffard 58b48dd
Merge branch 'main' into ag/graphql4
agriffard f9e6b91
Merge branch 'main' into ag/graphql4
agriffard 098106b
GraphQL4 - resolve async write using System.Text.Json (#11499)
MikeKry d96848a
Merge branch 'main' into ag/graphql4
agriffard 7a5eddc
Merge branch 'main' into ag/graphql4
sebastienros 2ddcc51
Update RequiresPermissionValidationRuleTests.cs
sebastienros 78cf8d6
Update RequiresPermissionValidationRuleTests.cs
sebastienros 89556f6
Reference NewtonSoft.Json
sebastienros b8eb3ba
Fix build
sebastienros 8d9bc0a
Bump version to 4.8.0
sebastienros File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
39 changes: 39 additions & 0 deletions
39
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/Extensions/DocumentWriterExtensions.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,39 @@ | ||
using System; | ||
using System.Net; | ||
using System.Net.Mime; | ||
using System.Threading.Tasks; | ||
using GraphQL; | ||
using Microsoft.AspNetCore.Http; | ||
|
||
namespace OrchardCore.Apis.GraphQL | ||
{ | ||
internal static class DocumentWriterExtensions | ||
{ | ||
public static async Task WriteErrorAsync(this IDocumentWriter documentWriter, HttpContext context, string message, Exception e = null) | ||
{ | ||
if (message == null) | ||
{ | ||
throw new ArgumentNullException(nameof(message)); | ||
} | ||
|
||
var errorResult = new ExecutionResult | ||
{ | ||
Errors = new ExecutionErrors() | ||
}; | ||
|
||
if (e == null) | ||
{ | ||
errorResult.Errors.Add(new ExecutionError(message)); | ||
} | ||
else | ||
{ | ||
errorResult.Errors.Add(new ExecutionError(message, e)); | ||
} | ||
|
||
context.Response.StatusCode = (int)HttpStatusCode.BadRequest; | ||
context.Response.ContentType = MediaTypeNames.Application.Json; | ||
|
||
await documentWriter.WriteAsync(context.Response.Body, errorResult); | ||
} | ||
} | ||
} |
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
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
21 changes: 15 additions & 6 deletions
21
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/OrchardFieldNameConverter.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,28 +1,37 @@ | ||
using System; | ||
using GraphQL; | ||
using GraphQL.Conversion; | ||
using GraphQL.Types; | ||
|
||
namespace OrchardCore.Apis.GraphQL | ||
{ | ||
public class OrchardFieldNameConverter : IFieldNameConverter | ||
public class OrchardFieldNameConverter : INameConverter | ||
{ | ||
private readonly IFieldNameConverter _defaultConverter = new CamelCaseFieldNameConverter(); | ||
private readonly INameConverter _defaultConverter = new CamelCaseNameConverter(); | ||
|
||
public string NameFor(string field, Type parentType) | ||
// todo: custom argument name? | ||
public string NameForArgument(string argumentName, IComplexGraphType parentGraphType, FieldType field) | ||
{ | ||
var attributes = parentType?.GetCustomAttributes(typeof(GraphQLFieldNameAttribute), true); | ||
carlwoodhouse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return _defaultConverter.NameForArgument(argumentName, parentGraphType, field); | ||
} | ||
|
||
// TODO: check functionality | ||
public string NameForField(string fieldName, IComplexGraphType parentGraphType) | ||
{ | ||
var attributes = parentGraphType?.GetType().GetCustomAttributes(typeof(GraphQLFieldNameAttribute), true); | ||
|
||
if (attributes != null) | ||
{ | ||
foreach (GraphQLFieldNameAttribute attribute in attributes) | ||
{ | ||
if (attribute.Field == field) | ||
if (attribute.Field == fieldName) | ||
{ | ||
return attribute.Mapped; | ||
} | ||
} | ||
} | ||
|
||
return _defaultConverter.NameFor(field, parentType); | ||
return _defaultConverter.NameForField(fieldName, parentGraphType); | ||
} | ||
} | ||
} |
38 changes: 0 additions & 38 deletions
38
src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/RequestServicesDependencyResolver.cs
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a comment here since the one before got removed