mirror of
https://github.com/KevinMidboe/linguist.git
synced 2025-10-29 09:40:21 +00:00
Add support for GraphQL (#2947)
* Add GraphQL to languages.yml * Add graphql submodule * Add graphql to grammars.yml * Add GraphQL samples * Updating licensed information
This commit is contained in:
committed by
Arfon Smith
parent
7c9fd59a99
commit
bce676e902
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -707,3 +707,6 @@
|
|||||||
[submodule "vendor/grammars/language-apl"]
|
[submodule "vendor/grammars/language-apl"]
|
||||||
path = vendor/grammars/language-apl
|
path = vendor/grammars/language-apl
|
||||||
url = https://github.com/Alhadis/language-apl.git
|
url = https://github.com/Alhadis/language-apl.git
|
||||||
|
[submodule "vendor/grammars/language-graphql"]
|
||||||
|
path = vendor/grammars/language-graphql
|
||||||
|
url = https://github.com/rmosolgo/language-graphql
|
||||||
|
|||||||
@@ -340,6 +340,8 @@ vendor/grammars/language-csharp:
|
|||||||
- source.nant-build
|
- source.nant-build
|
||||||
vendor/grammars/language-gfm:
|
vendor/grammars/language-gfm:
|
||||||
- source.gfm
|
- source.gfm
|
||||||
|
vendor/grammars/language-graphql:
|
||||||
|
- source.graphql
|
||||||
vendor/grammars/language-hy:
|
vendor/grammars/language-hy:
|
||||||
- source.hy
|
- source.hy
|
||||||
vendor/grammars/language-inform7:
|
vendor/grammars/language-inform7:
|
||||||
|
|||||||
@@ -1262,6 +1262,14 @@ Graph Modeling Language:
|
|||||||
tm_scope: none
|
tm_scope: none
|
||||||
ace_mode: text
|
ace_mode: text
|
||||||
|
|
||||||
|
GraphQL:
|
||||||
|
type: data
|
||||||
|
extensions:
|
||||||
|
- .graphql
|
||||||
|
color: "#E535AB"
|
||||||
|
tm_scope: source.graphql
|
||||||
|
ace_mode: text
|
||||||
|
|
||||||
Graphviz (DOT):
|
Graphviz (DOT):
|
||||||
type: data
|
type: data
|
||||||
tm_scope: source.dot
|
tm_scope: source.dot
|
||||||
|
|||||||
57
samples/GraphQL/kitchen-sink.graphql
Normal file
57
samples/GraphQL/kitchen-sink.graphql
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
# Copyright (c) 2015, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
query queryName($foo: ComplexType, $site: Site = MOBILE) {
|
||||||
|
whoever123is: node(id: [123, 456]) {
|
||||||
|
id ,
|
||||||
|
... on User @defer {
|
||||||
|
field2 {
|
||||||
|
id ,
|
||||||
|
alias: field1(first:10, after:$foo,) @include(if: $foo) {
|
||||||
|
id,
|
||||||
|
...frag
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
... @skip(unless: $foo) {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
... {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mutation likeStory {
|
||||||
|
like(story: 123) @defer {
|
||||||
|
story {
|
||||||
|
id
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
subscription StoryLikeSubscription($input: StoryLikeSubscribeInput) {
|
||||||
|
storyLikeSubscribe(input: $input) {
|
||||||
|
story {
|
||||||
|
likers {
|
||||||
|
count
|
||||||
|
}
|
||||||
|
likeSentence {
|
||||||
|
text
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fragment frag on Friend {
|
||||||
|
foo(size: $size, bar: $b, obj: {key: "value"})
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
unnamed(truthy: true, falsey: false),
|
||||||
|
query
|
||||||
|
}
|
||||||
50
samples/GraphQL/schema-kitchen-sink.graphql
Normal file
50
samples/GraphQL/schema-kitchen-sink.graphql
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# Copyright (c) 2015, Facebook, Inc.
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the BSD-style license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree. An additional grant
|
||||||
|
# of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
|
||||||
|
schema {
|
||||||
|
query: QueryType
|
||||||
|
mutation: MutationType
|
||||||
|
}
|
||||||
|
|
||||||
|
type Foo implements Bar {
|
||||||
|
one: Type
|
||||||
|
two(argument: InputType!): Type
|
||||||
|
three(argument: InputType, other: String): Int
|
||||||
|
four(argument: String = "string"): String
|
||||||
|
five(argument: [String] = ["string", "string"]): String
|
||||||
|
six(argument: InputType = {key: "value"}): Type
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Bar {
|
||||||
|
one: Type
|
||||||
|
four(argument: String = "string"): String
|
||||||
|
}
|
||||||
|
|
||||||
|
union Feed = Story | Article | Advert
|
||||||
|
|
||||||
|
scalar CustomScalar
|
||||||
|
|
||||||
|
enum Site {
|
||||||
|
DESKTOP
|
||||||
|
MOBILE
|
||||||
|
}
|
||||||
|
|
||||||
|
input InputType {
|
||||||
|
key: String!
|
||||||
|
answer: Int = 42
|
||||||
|
}
|
||||||
|
|
||||||
|
extend type Foo {
|
||||||
|
seven(argument: [String]): Type
|
||||||
|
}
|
||||||
|
|
||||||
|
directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT
|
||||||
|
|
||||||
|
directive @include(if: Boolean!)
|
||||||
|
on FIELD
|
||||||
|
| FRAGMENT_SPREAD
|
||||||
|
| INLINE_FRAGMENT
|
||||||
1
vendor/grammars/language-graphql
vendored
Submodule
1
vendor/grammars/language-graphql
vendored
Submodule
Submodule vendor/grammars/language-graphql added at 037e5d46ea
7
vendor/licenses/grammar/language-graphql.txt
vendored
Normal file
7
vendor/licenses/grammar/language-graphql.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
type: grammar
|
||||||
|
name: language-graphql
|
||||||
|
license: mit
|
||||||
|
curated: true
|
||||||
|
---
|
||||||
|
MIT
|
||||||
Reference in New Issue
Block a user