Skip to content

Commit

Permalink
Merge pull request #59 from graphql-dotnet/deps-reorg
Browse files Browse the repository at this point in the history
Reorganisation of dependencies
  • Loading branch information
tlil authored Aug 16, 2017
2 parents 626f164 + 5ace0f6 commit 96a5a1e
Show file tree
Hide file tree
Showing 440 changed files with 42,866 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion deps/graphql-dotnet
Submodule graphql-dotnet deleted from 1983d0
26 changes: 26 additions & 0 deletions deps/graphql-dotnet/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[*.cs]
indent_size = 4
indent_style = space

[*.js]
charset = utf-8
indent_style = space
indent_size = 2

[{package.json}]
indent_style = space
indent_size = 2
24 changes: 24 additions & 0 deletions deps/graphql-dotnet/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"browser": true,
"node": true
},
"parser": "babel-eslint",
"plugins": [
"babel"
],
"rules": {
"constructor-super": 2,
"comma-spacing": 2,
"comma-style": [2, "last"],
"babel/object-shorthand": 2,
"one-var": [2, { "initialized": "never" }],
"key-spacing": 0,
"no-this-before-super": 2,
"no-underscore-dangle": 0,
"no-unused-vars": [2, { "vars": "all", "args": "none" }],
"no-var": 2,
"quotes": [2, "single", "avoid-escape"],
"strict": 0
}
}
6 changes: 6 additions & 0 deletions deps/graphql-dotnet/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
22 changes: 22 additions & 0 deletions deps/graphql-dotnet/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.DS_Store

.vs/
.vscode/
.idea/
*.user
*.suo
*.nupkg
*.project.lock.json
project.lock.json
npm-debug.log
yarn-error.log
bundle.js
fixie-results.xml

TestResults/
[Oo]bj/
[Bb]in/
packages/
node_modules/
nuget/lib
artifacts
21 changes: 21 additions & 0 deletions deps/graphql-dotnet/LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2015 Joseph T. McBride

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
220 changes: 220 additions & 0 deletions deps/graphql-dotnet/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
# GraphQL for .NET

[![Build Status](https://ci.appveyor.com/api/projects/status/github/graphql-dotnet/graphql-dotnet?branch=master&svg=true)](https://ci.appveyor.com/project/graphql-dotnet-ci/graphql-dotnet)
[![NuGet](https://img.shields.io/nuget/v/GraphQL.svg)](https://www.nuget.org/packages/GraphQL/)
[![Join the chat at https://gitter.im/graphql-dotnet/graphql-dotnet](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/graphql-dotnet/graphql-dotnet?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

This is an implementation of [Facebook's GraphQL](https://github.com/facebook/graphql) in .NET.

This project uses a [lexer/parser](http://github.com/graphql-dotnet/parser) originally written by [Marek Magdziak](https://github.com/mkmarek) and released with a MIT license. Thank you Marek!

## Installation

You can install the latest version via [NuGet](https://www.nuget.org/packages/GraphQL/).

`PM> Install-Package GraphQL`

## Upgrade Guide

* [0.11.0](/upgrade-guides/v0.11.0.md)
* [0.8.0](/upgrade-guides/v0.8.0.md)

## GraphiQL sample
There is a sample web api project hosting the GraphiQL interface. `yarn install` and `yarn start` from the root of the repository, then run the web project from Visual Studio.

> Note: Before running the GraphiQL project: make sure you Build the entire solution so that all the project references get built. (GraphQL, GraphQL-Parser, etc) to avoid missing reference/assembly errors.

```
> npm install -g yarn
> yarn install
> yarn start
```
![](http://i.imgur.com/2uGdVAj.png)

## Usage

Define your schema with a top level query object then execute that query.

A more full-featured example including all classes required can be found [here](https://github.com/graphql-dotnet/graphql-dotnet/tree/master/src/GraphQL.StarWars).

```csharp
namespace ConsoleApplication
{
using System;
using System.Threading.Tasks;
using GraphQL;
using GraphQL.Http;
using GraphQL.Types;

public class Program
{
public static void Main(string[] args)
{
Run();
}

private static async void Run()
{
Console.WriteLine("Hello GraphQL!");

var schema = new Schema { Query = new StarWarsQuery() };

var result = await new DocumentExecuter().ExecuteAsync( _ =>
{
_.Schema = schema;
_.Query = @"
query {
hero {
id
name
}
}
";
}).ConfigureAwait(false);

var json = new DocumentWriter(indent: true).Write(result);

Console.WriteLine(json);
}
}

public class Droid
{
public string Id { get; set; }
public string Name { get; set; }
}

public class DroidType : ObjectGraphType<Droid>
{
public DroidType()
{
Field(x => x.Id).Description("The Id of the Droid.");
Field(x => x.Name, nullable: true).Description("The name of the Droid.");
}
}

public class StarWarsQuery : ObjectGraphType
{
public StarWarsQuery()
{
Field<DroidType>(
"hero",
resolve: context => new Droid { Id = "1", Name = "R2-D2" }
);
}
}
}
```

Output
```
Hello GraphQL!
{
"data": {
"hero": {
"id": "1",
"name": "R2-D2"
}
}
}
```

## Roadmap

### Grammar / AST
- Grammar and AST for the GraphQL language should be compatible with the April 2016 specification.

### Operation Execution
- [x] Scalars
- [x] Objects
- [x] Lists of objects/interfaces
- [x] Interfaces
- [x] Unions
- [x] Arguments
- [x] Variables
- [x] Fragments
- [x] Directives
- [x] Include
- [x] Skip
- [x] Custom
- [x] Enumerations
- [x] Input Objects
- [x] Mutations
- [x] Subscriptions
- [x] Async execution

### Validation
- [x] Arguments of correct type
- [x] Default values of correct type
- [x] Fields on correct type
- [x] Fragments on composite types
- [x] Known argument names
- [x] Known directives
- [x] Known fragment names
- [x] Known type names
- [x] Lone anonymous operations
- [x] No fragment cycles
- [x] No undefined variables
- [x] No unused fragments
- [x] No unused variables
- [ ] Overlapping fields can be merged
- [x] Possible fragment spreads
- [x] Provide non-null arguments
- [x] Scalar leafs
- [x] Unique argument names
- [ ] Unique directives per location
- [x] Unique fragment names
- [x] Unique input field names
- [x] Unique operation names
- [x] Unique variable names
- [x] Variables are input types
- [x] Variables in allowed position

### Schema Introspection
- [x] __typename
- [x] __type
- [x] name
- [x] kind
- [x] description
- [x] fields
- [x] interfaces
- [x] possibleTypes
- [x] enumValues
- [x] inputFields
- [x] ofType
- [x] __schema
- [x] types
- [x] queryType
- [x] mutationType
- [x] subscriptionType
- [x] directives

### Deployment Process

```
yarn run setVersion 0.17.0
git commit/push
download nuget from AppVeyor
upload nuget package to github
publish nuget from MyGet
```


### Running on .NET Core
The GraphQL.GraphiQLCore project runs on `.NET Core 1.1`. You can run from Visual Studio Code or from the command line using `dotnet run`. When you run the project, you will see the GraphiQL editor open.

When using Visual Studio Code, open to the `./src/GraphQL.GraphiQLCore` folder. You will get a warning "Required assets to build and debug are missing from 'GraphQL.GraphiQLCore'. Add Them?". Choose `Yes`. This will add the necessary launch.json and tasks.json files.

### Running on OSX with mono
To run this project on OSX with mono you will need to add some configuration. Make sure mono is installed and add the following to your bash configuration:

```bash
export FrameworkPathOverride=/Library/Frameworks/Mono.framework/Versions/4.6.2/lib/mono/4.5/
```

See the following for more details:

* [Building VS 2017 MSBuild csproj Projects with Mono on Linux](https://stackoverflow.com/questions/42747722/building-vs-2017-msbuild-csproj-projects-with-mono-on-linux)
* [using .NET Framework as targets framework, the osx/unix build fails](https://github.com/dotnet/netcorecli-fsc/wiki/.NET-Core-SDK-rc4#using-net-framework-as-targets-framework-the-osxunix-build-fails)

38 changes: 38 additions & 0 deletions deps/graphql-dotnet/appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: 0.17.2.{build}
pull_requests:
do_not_increment_build_number: true
skip_tags: true
environment:
CI: true

nuget:
account_feed: true
project_feed: true
disable_publish_on_pr: true

install:
- npm install -g npm
- npm --version
- ps: Install-Product node LTS
- node --version
- dotnet --version

build_script:
- cmd: >-
yarn build-ci
test: off

artifacts:
- path: 'artifacts\*.nupkg'

deploy:
- provider: NuGet
server: https://www.myget.org/F/graphql-dotnet/api/v2/package
api_key:
secure: +l1vfBMajn1WfmXkQ2LdILKxK4fQ5AHSnnU1kf11Bn1xRGUOTCdPhLwHx232piEn
skip_symbols: true
on:
branch:
- master
- dev
2 changes: 2 additions & 0 deletions deps/graphql-dotnet/docs/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name: GraphQL for .NET
theme: jekyll-theme-cayman
Loading

0 comments on commit 96a5a1e

Please sign in to comment.