mirror of
https://github.com/XAMPPRocky/tokei
synced 2024-10-02 14:03:31 +00:00
Add GraphQL support (#306)
* Add GraphQL support * Fix line count on Graphql test file * Add extra final new line to GraphQL test file * Fix line counts on graphql test file * Fix typo on graphql test file
This commit is contained in:
parent
41b120ad2d
commit
d46d511cd8
|
@ -636,6 +636,20 @@
|
|||
"go"
|
||||
]
|
||||
},
|
||||
"Graphql":{
|
||||
"name":"GraphQL",
|
||||
"quotes":[
|
||||
["\\\"", "\\\""],
|
||||
["\\\"\\\"\\\"", "\\\"\\\"\\\""]
|
||||
],
|
||||
"line_comment":[
|
||||
"#"
|
||||
],
|
||||
"extensions":[
|
||||
"gql",
|
||||
"graphql"
|
||||
]
|
||||
},
|
||||
"Groovy":{
|
||||
"base":"c",
|
||||
"extensions":[
|
||||
|
|
89
tests/data/graphql.gql
Normal file
89
tests/data/graphql.gql
Normal file
|
@ -0,0 +1,89 @@
|
|||
# 89 lines 71 code 3 comments 15 blanks
|
||||
|
||||
"""
|
||||
A simple GraphQL schema which is well described. This is not a comment.
|
||||
See: https://facebook.github.io/graphql/June2018/#sec-Descriptions
|
||||
"""
|
||||
type Query {
|
||||
"""
|
||||
Translates a string from a given language into a different language.
|
||||
"""
|
||||
translate(
|
||||
"The original language that `text` is provided in."
|
||||
fromLanguage: Language
|
||||
|
||||
"The translated language to be returned."
|
||||
toLanguage: Language
|
||||
|
||||
"The text to be translated."
|
||||
text: String
|
||||
): String
|
||||
}
|
||||
|
||||
"""
|
||||
The set of languages supported by `translate`.
|
||||
"""
|
||||
enum Language {
|
||||
"English"
|
||||
EN
|
||||
|
||||
"French"
|
||||
FR
|
||||
|
||||
"Chinese"
|
||||
CH
|
||||
}
|
||||
|
||||
# Comment the query and use "quotes" inside the comment
|
||||
query withFragments($expandedInfo: Boolean) {
|
||||
user(id: "3bd5a1cbed10e") {
|
||||
id # Insignificant comment
|
||||
|
||||
... @include(if: $expandedInfo) {
|
||||
firstName
|
||||
lastName
|
||||
birthday
|
||||
}
|
||||
|
||||
friends(first: 10) {
|
||||
...friendFields
|
||||
}
|
||||
|
||||
profiles(
|
||||
handles: [
|
||||
"zuck",
|
||||
"cocacola",
|
||||
"#hashed#hash#inside"
|
||||
]
|
||||
) {
|
||||
handle
|
||||
|
||||
... on User {
|
||||
friends {
|
||||
count
|
||||
}
|
||||
}
|
||||
|
||||
... on Page {
|
||||
likers {
|
||||
count
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fragment friendFields on User {
|
||||
id
|
||||
firstName
|
||||
profilePic(size: 50)
|
||||
}
|
||||
|
||||
# A simple GraphQL type definition
|
||||
type User {
|
||||
id: ID
|
||||
firstName: String
|
||||
lastName: String
|
||||
birthday: Date
|
||||
}
|
||||
|
Loading…
Reference in a new issue