-
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 4256fdb
Showing
160 changed files
with
11,538 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
*.DS_Store | ||
|
||
.vs/ | ||
.vscode/ | ||
.idea/ | ||
*.user | ||
*.suo | ||
*.nupkg | ||
*.lock.json | ||
npm-debug.log | ||
bundle.js | ||
fixie-results.xml | ||
|
||
TestResults/ | ||
[Oo]bj/ | ||
[Bb]in/ | ||
packages/ | ||
node_modules/ | ||
nuget/lib |
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,3 @@ | ||
[submodule "deps/graphql-dotnet"] | ||
path = deps/graphql-dotnet | ||
url = https://github.com/graphql-dotnet/graphql-dotnet.git |
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,47 @@ | ||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio 15 | ||
VisualStudioVersion = 15.0.0.0 | ||
MinimumVisualStudioVersion = 15.0.0.0 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GraphQL.Conventions", "src\GraphQL.Conventions\GraphQL.Conventions.csproj", "{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}" | ||
EndProject | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tests", "test\Tests\Tests.csproj", "{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Debug|x64 = Debug|x64 | ||
Debug|x86 = Debug|x86 | ||
Release|Any CPU = Release|Any CPU | ||
Release|x64 = Release|x64 | ||
Release|x86 = Release|x86 | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x64.Build.0 = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Debug|x86.Build.0 = Debug|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x64.ActiveCfg = Release|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x64.Build.0 = Release|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x86.ActiveCfg = Release|Any CPU | ||
{AEAC9A4B-7D5B-48C6-86A9-E665F6DE4B6C}.Release|x86.Build.0 = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x64.Build.0 = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Debug|x86.Build.0 = Debug|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x64.ActiveCfg = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x64.Build.0 = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x86.ActiveCfg = Release|Any CPU | ||
{5CF44C73-E5C9-4E53-A69D-4013E8AE85E5}.Release|x86.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
EndGlobal |
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,72 @@ | ||
GraphQL Conventions Library for .NET | ||
==================================== | ||
|
||
## Introduction | ||
[GraphQL .NET](https://www.github.com/graphql-dotnet/graphql-dotnet) has been around for a while. This library is a complementary layer on top that allows you to automatically wrap your .NET classes into GraphQL schema definitions using existing property getters and methods as field resolvers. | ||
|
||
In short, this project builds on top of the following components: | ||
|
||
* The [GraphQL](https://github.com/graphql-dotnet/graphql-dotnet) library written by [Joe McBride](https://github.com/joemcbride) (MIT licence) | ||
* The GraphQL [lexer/parser](http://github.com/graphql-dotnet/parser) originally written by [Marek Magdziak](https://github.com/mkmarek) (MIT licence) | ||
|
||
## Installation | ||
|
||
Download and install the package from [NuGet](https://www.nuget.org/packages/GraphQL.Conventions): | ||
|
||
```powershell | ||
PS> Install-Package GraphQL.Conventions | ||
``` | ||
|
||
The following targets are available: | ||
|
||
* .NET Framework 4.5 | ||
* .NET Platform Standard 1.5 | ||
|
||
## Getting Started | ||
|
||
Implement your query type: | ||
|
||
```cs | ||
[ImplementViewer(OperationType.Query)] | ||
public class Query | ||
{ | ||
[Description("Retrieve book by its globally unique ID.")] | ||
public Task<Book> Book(UserContext context, Id id) => | ||
context.Get<Book>(id); | ||
|
||
[Description("Retrieve author by his/her globally unique ID.")] | ||
public Task<Author> Author(UserContext context, Id id) => | ||
context.Get<Author>(id); | ||
|
||
[Description("Search for books and authors.")] | ||
public Connection<SearchResult> Search( | ||
UserContext context, | ||
[Description("Title or last name.")] NonNull<string> forString, | ||
[Description("Only return search results after given cursor.")] Cursor? after, | ||
[Description("Return the first N results.")] int? first) | ||
{ | ||
return context | ||
.Search(forString.Value) | ||
.Select(node => new SearchResult { Instance = node }) | ||
.ToConnection(first ?? 5, after); | ||
} | ||
} | ||
``` | ||
|
||
Construct your schema and run your query: | ||
|
||
```cs | ||
using GraphQL.Conventions; | ||
|
||
var engine = GraphQLEngine.New<Query>(); | ||
var result = await engine | ||
.NewExecutor() | ||
.WithUserContext(userContext) | ||
.WithDependencyInjector(dependencyInjector) | ||
.WithRequest(requestBody) | ||
.Execute(); | ||
``` | ||
|
||
## Examples | ||
|
||
More detailed examples can be found in the [unit tests](https://github.com/graphql-dotnet/conventions/tree/master/test/GraphQL.Conventions.Tests) and the included [test server](https://github.com/graphql-dotnet/conventions/tree/master/test/GraphQL.Conventions.Tests.Server). |
Submodule graphql-dotnet
added at
4ae633
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,7 @@ | ||
{ | ||
"projects": [ | ||
"src", | ||
"test", | ||
"deps/graphql-dotnet/src" | ||
] | ||
} |
Oops, something went wrong.