@xyd-js/gql 0.1.0-xyd.5 → 0.1.0-xyd.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +450 -0
- package/LICENSE +21 -0
- package/TODO.md +8 -0
- package/__fixtures__/-1.opendocs.docs-nested/input.graphql +66 -0
- package/__fixtures__/-1.opendocs.docs-nested/output.json +554 -0
- package/__fixtures__/-1.opendocs.flat/input.graphql +19 -0
- package/__fixtures__/-1.opendocs.flat/output.json +243 -0
- package/__fixtures__/-1.opendocs.scopes/input.graphql +33 -0
- package/__fixtures__/-1.opendocs.scopes/output.json +378 -0
- package/__fixtures__/-1.opendocs.sidebar/input.graphql +44 -0
- package/__fixtures__/-1.opendocs.sort/input.graphql +92 -0
- package/__fixtures__/-1.opendocs.sort/output.json +1078 -0
- package/__fixtures__/-1.opendocs.sort+group/input.graphql +111 -0
- package/__fixtures__/-1.opendocs.sort+group/output.json +1114 -0
- package/__fixtures__/-1.opendocs.sort+group+path/input.graphql +118 -0
- package/__fixtures__/-1.opendocs.sort+group+path/output.json +1114 -0
- package/__fixtures__/-2.complex.github/input.graphql +69424 -0
- package/__fixtures__/-2.complex.github/output.json +269874 -0
- package/__fixtures__/-2.complex.livesession/input.graphql +23 -0
- package/__fixtures__/-2.complex.livesession/output.json +302 -0
- package/__fixtures__/-2.complex.monday/input.graphql +6089 -0
- package/__fixtures__/-2.complex.monday/output.json +1 -0
- package/__fixtures__/-3.array-non-null-return/input.graphql +9 -0
- package/__fixtures__/-3.array-non-null-return/output.json +151 -0
- package/__fixtures__/1.basic/input.graphql +118 -0
- package/__fixtures__/1.basic/output.json +630 -0
- package/__fixtures__/2.circular/input.graphql +17 -0
- package/__fixtures__/2.circular/output.json +248 -0
- package/__fixtures__/3.opendocs/input.graphql +27 -0
- package/__fixtures__/3.opendocs/output.json +338 -0
- package/__fixtures__/4.union/input.graphql +19 -0
- package/__fixtures__/4.union/output.json +344 -0
- package/__fixtures__/5.flat/input.graphql +27 -0
- package/__fixtures__/5.flat/output.json +383 -0
- package/__fixtures__/6.default-values/input.graphql +47 -0
- package/__fixtures__/6.default-values/output.json +655 -0
- package/__fixtures__/7.type-args/input.graphql +19 -0
- package/__fixtures__/7.type-args/output.json +301 -0
- package/__fixtures__/8.default-sort/input.graphql +60 -0
- package/__fixtures__/8.default-sort/output.json +1078 -0
- package/__tests__/gqlSchemaToReferences.test.ts +109 -0
- package/__tests__/utils.ts +45 -0
- package/declarations.d.ts +4 -0
- package/dist/index.d.ts +17 -1
- package/dist/index.js +1334 -19871
- package/dist/index.js.map +1 -1
- package/dist/opendocs.graphql +56 -0
- package/package.json +7 -9
- package/src/context.ts +17 -0
- package/src/converters/gql-arg.ts +51 -0
- package/src/converters/gql-enum.ts +27 -0
- package/src/converters/gql-field.ts +164 -0
- package/src/converters/gql-input.ts +34 -0
- package/src/converters/gql-interface.ts +35 -0
- package/src/converters/gql-mutation.ts +36 -0
- package/src/converters/gql-object.ts +83 -0
- package/src/converters/gql-operation.ts +128 -0
- package/src/converters/gql-query.ts +36 -0
- package/src/converters/gql-sample.ts +159 -0
- package/src/converters/gql-scalar.ts +16 -0
- package/src/converters/gql-subscription.ts +36 -0
- package/src/converters/gql-types.ts +195 -0
- package/src/converters/gql-union.ts +40 -0
- package/src/gql-core.ts +362 -0
- package/src/opendocs.graphql +56 -0
- package/src/opendocs.ts +253 -0
- package/src/schema.ts +253 -67
- package/src/types.ts +103 -0
- package/src/utils.ts +21 -96
- package/tsconfig.json +1 -1
- package/tsup.config.ts +15 -1
- package/vitest.config.ts +15 -1
- package/examples/basic/index.ts +0 -12
- package/examples/basic/schema.graphqls +0 -89
- package/examples/basic/todo-app.graphqls +0 -184
- package/examples/graphql-types/graphql-types.0.basic.graphqls +0 -28
- package/examples/nested/nested-arg.0.not-required.graphqls +0 -8
- package/examples/nested/nested-arg.0.required.graphqls +0 -8
- package/examples/nested/nested-arg.1.deep.graphqls +0 -12
- package/src/hydration/README.md +0 -1
- package/src/hydration/gql-arg.ts +0 -53
- package/src/hydration/gql-field.ts +0 -206
- package/src/hydration/gql-input.ts +0 -67
- package/src/hydration/gql-object.ts +0 -35
- package/src/hydration/gql-types.ts +0 -50
- package/src/samples/index.ts +0 -95
- package/test/graphql-types.0.test.ts +0 -125
- package/test/nested-arg.0.test.ts +0 -208
- package/test/nested-arg.1.test.ts +0 -19
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {GraphQLEnumType} from "graphql";
|
|
2
|
-
|
|
3
|
-
import {GraphQLScalarType} from "@graphql-markdown/types";
|
|
4
|
-
|
|
5
|
-
import type {DefinitionProperty, Reference} from "@xyd-js/uniform";
|
|
6
|
-
|
|
7
|
-
// gqlEnumToUniformRef is a helper function to convert a GraphQL enum type into a 'uniform' reference.
|
|
8
|
-
export function gqlEnumToUniformRef(gqlType: GraphQLEnumType): Reference {
|
|
9
|
-
const props: DefinitionProperty[] = gqlType.getValues().map(value => ({
|
|
10
|
-
name: value.name,
|
|
11
|
-
type: "string",
|
|
12
|
-
description: value.description || "",
|
|
13
|
-
}))
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
title: gqlType.name,
|
|
17
|
-
description: gqlType.description || "",
|
|
18
|
-
canonical: `enum-${gqlType.name}`, // TODO: better solution
|
|
19
|
-
context: {
|
|
20
|
-
graphqlName: gqlType.name,
|
|
21
|
-
graphqlTypeShort: "enum" // TODO: better solution
|
|
22
|
-
},
|
|
23
|
-
definitions: [
|
|
24
|
-
{
|
|
25
|
-
title: "Valid values",
|
|
26
|
-
properties: props
|
|
27
|
-
}
|
|
28
|
-
],
|
|
29
|
-
examples: {
|
|
30
|
-
groups: []
|
|
31
|
-
}
|
|
32
|
-
} as Reference
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// gqlScalarToUniformRef is a helper function to convert a GraphQL scalar type into a 'uniform' reference.
|
|
36
|
-
export function gqlScalarToUniformRef(gqlType: GraphQLScalarType): Reference {
|
|
37
|
-
return {
|
|
38
|
-
title: gqlType.name,
|
|
39
|
-
description: gqlType.description || "",
|
|
40
|
-
canonical: `scalar-${gqlType.name}`, // TODO: better solution
|
|
41
|
-
context: {
|
|
42
|
-
graphqlName: gqlType.name,
|
|
43
|
-
graphqlTypeShort: "scalar" // TODO: better solution
|
|
44
|
-
},
|
|
45
|
-
definitions: [],
|
|
46
|
-
examples: {
|
|
47
|
-
groups: []
|
|
48
|
-
}
|
|
49
|
-
} as Reference
|
|
50
|
-
}
|
package/src/samples/index.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import {jsonToGraphQLQuery, VariableType} from "json-to-graphql-query";
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
DefinitionProperty,
|
|
5
|
-
ReferenceType
|
|
6
|
-
} from "@xyd-js/uniform";
|
|
7
|
-
|
|
8
|
-
// simpleGraphqlExample is a helper function to create a simple GraphQL example query or mutation.
|
|
9
|
-
export function simpleGraphqlExample(
|
|
10
|
-
operationType: ReferenceType.GRAPHQL_QUERY | ReferenceType.GRAPHQL_MUTATION,
|
|
11
|
-
operationName: string,
|
|
12
|
-
args: DefinitionProperty[],
|
|
13
|
-
returns: DefinitionProperty[],
|
|
14
|
-
) {
|
|
15
|
-
let obj: any = {}
|
|
16
|
-
|
|
17
|
-
switch (operationType) {
|
|
18
|
-
case ReferenceType.GRAPHQL_QUERY: {
|
|
19
|
-
const exampleReturnProps = exampleReturns(returns)
|
|
20
|
-
|
|
21
|
-
obj = {
|
|
22
|
-
query: {
|
|
23
|
-
__name: operationName,
|
|
24
|
-
[operationName]: exampleReturnProps
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
break
|
|
29
|
-
}
|
|
30
|
-
case ReferenceType.GRAPHQL_MUTATION: {
|
|
31
|
-
const exampleReturnProps = exampleReturns(returns)
|
|
32
|
-
const vars = exampleVariables(args)
|
|
33
|
-
const argumen = exampleArguments(args)
|
|
34
|
-
|
|
35
|
-
obj = {
|
|
36
|
-
mutation: {
|
|
37
|
-
__name: operationName,
|
|
38
|
-
__variables: vars,
|
|
39
|
-
[operationName]: {
|
|
40
|
-
...exampleReturnProps,
|
|
41
|
-
__args: argumen,
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
break;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
return jsonToGraphQLQuery(obj, {pretty: true});
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// exampleReturns return an example of return GraphQL object
|
|
54
|
-
function exampleReturns(
|
|
55
|
-
properties: DefinitionProperty[],
|
|
56
|
-
obj: any = {}
|
|
57
|
-
) {
|
|
58
|
-
properties.forEach((property) => {
|
|
59
|
-
// TODO: only if required?
|
|
60
|
-
obj[property.name] = true
|
|
61
|
-
|
|
62
|
-
if (property?.properties?.length) {
|
|
63
|
-
obj[property.name] = {}
|
|
64
|
-
exampleReturns(property.properties, obj[property.name])
|
|
65
|
-
}
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
return obj
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// exampleArguments return an example of GraphQL arguments
|
|
72
|
-
function exampleArguments(
|
|
73
|
-
properties: DefinitionProperty[],
|
|
74
|
-
obj: any = {}
|
|
75
|
-
) {
|
|
76
|
-
|
|
77
|
-
properties.forEach((property) => {
|
|
78
|
-
obj[property.name] = new VariableType(property.name)
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
return obj
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// exampleVariables return an example of GraphQL variables
|
|
85
|
-
function exampleVariables(
|
|
86
|
-
properties: DefinitionProperty[],
|
|
87
|
-
obj: any = {}
|
|
88
|
-
) {
|
|
89
|
-
|
|
90
|
-
properties.forEach((property) => {
|
|
91
|
-
obj[property.name] = property.type
|
|
92
|
-
})
|
|
93
|
-
|
|
94
|
-
return obj
|
|
95
|
-
}
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
import {beforeEach, describe, expect, it} from 'vitest'
|
|
4
|
-
|
|
5
|
-
import {gqlSchemaToReferences} from "../src";
|
|
6
|
-
|
|
7
|
-
describe('graphql-types', async () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('0.basic', async () => {
|
|
12
|
-
const schemaLocation = path.join(process.cwd(), "./examples/graphql-types/graphql-types.0.basic.graphqls")
|
|
13
|
-
|
|
14
|
-
const references = await gqlSchemaToReferences(schemaLocation)
|
|
15
|
-
|
|
16
|
-
const equal = [
|
|
17
|
-
{
|
|
18
|
-
"canonical": "Date",
|
|
19
|
-
"description": "This is a custom scalar type for Date.",
|
|
20
|
-
"context": {
|
|
21
|
-
"graphqlName": "Date",
|
|
22
|
-
"graphqlType": "scalar"
|
|
23
|
-
},
|
|
24
|
-
"definitions": [],
|
|
25
|
-
"examples": {
|
|
26
|
-
"groups": []
|
|
27
|
-
},
|
|
28
|
-
"title": "Date"
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
"canonical": "Role",
|
|
32
|
-
"description": "This is a custom enum type for Role.",
|
|
33
|
-
"context": {
|
|
34
|
-
"graphqlName": "Role",
|
|
35
|
-
"graphqlType": "enum"
|
|
36
|
-
},
|
|
37
|
-
"definitions": [
|
|
38
|
-
{
|
|
39
|
-
"properties": [
|
|
40
|
-
{
|
|
41
|
-
"description": "",
|
|
42
|
-
"name": "ADMIN",
|
|
43
|
-
"type": "string"
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
"description": "",
|
|
47
|
-
"name": "OWNER",
|
|
48
|
-
"type": "string"
|
|
49
|
-
}
|
|
50
|
-
],
|
|
51
|
-
"title": "Valid values"
|
|
52
|
-
}
|
|
53
|
-
],
|
|
54
|
-
"examples": {
|
|
55
|
-
"groups": []
|
|
56
|
-
},
|
|
57
|
-
"title": "Role"
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
"title": "BookInput",
|
|
61
|
-
"description": "This is a custom input type for Book.",
|
|
62
|
-
"canonical": "BookInput",
|
|
63
|
-
"context": {
|
|
64
|
-
"graphqlName": "BookInput",
|
|
65
|
-
"graphqlType": "input"
|
|
66
|
-
},
|
|
67
|
-
"definitions": [
|
|
68
|
-
{
|
|
69
|
-
"title": "Fields",
|
|
70
|
-
"properties": [
|
|
71
|
-
{
|
|
72
|
-
"name": "title",
|
|
73
|
-
"type": "String!",
|
|
74
|
-
"description": "",
|
|
75
|
-
"properties": []
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
"name": "author",
|
|
79
|
-
"type": "String!",
|
|
80
|
-
"description": "",
|
|
81
|
-
"properties": []
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
],
|
|
86
|
-
"examples": {
|
|
87
|
-
"groups": []
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
"title": "Book",
|
|
92
|
-
"description": "This is a custom type for Book.",
|
|
93
|
-
"canonical": "Book",
|
|
94
|
-
"context": {
|
|
95
|
-
"graphqlName": "Book",
|
|
96
|
-
"graphqlType": "object"
|
|
97
|
-
},
|
|
98
|
-
"definitions": [
|
|
99
|
-
{
|
|
100
|
-
"title": "Fields",
|
|
101
|
-
"properties": [
|
|
102
|
-
{
|
|
103
|
-
"name": "title",
|
|
104
|
-
"type": "String!",
|
|
105
|
-
"description": "",
|
|
106
|
-
"properties": []
|
|
107
|
-
},
|
|
108
|
-
{
|
|
109
|
-
"name": "author",
|
|
110
|
-
"type": "String!",
|
|
111
|
-
"description": "",
|
|
112
|
-
"properties": []
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
"examples": {
|
|
118
|
-
"groups": []
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
]
|
|
122
|
-
|
|
123
|
-
expect(references).toEqual(equal)
|
|
124
|
-
})
|
|
125
|
-
})
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
import {beforeEach, describe, expect, it} from 'vitest'
|
|
4
|
-
|
|
5
|
-
import {gqlSchemaToReferences} from "../src";
|
|
6
|
-
|
|
7
|
-
describe('nested-arg', async () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('0.required', async () => {
|
|
12
|
-
const schemaLocation = path.join(process.cwd(), "./examples/nested/nested-arg.0.required.graphqls")
|
|
13
|
-
|
|
14
|
-
const references = await gqlSchemaToReferences(schemaLocation)
|
|
15
|
-
|
|
16
|
-
const equal = [
|
|
17
|
-
{
|
|
18
|
-
"title": "addBook",
|
|
19
|
-
"canonical": "addBook",
|
|
20
|
-
"description": "",
|
|
21
|
-
"category": "graphql",
|
|
22
|
-
"type": "graphql_mutation",
|
|
23
|
-
"examples": {
|
|
24
|
-
"groups": [
|
|
25
|
-
{
|
|
26
|
-
"description": "Example request",
|
|
27
|
-
"examples": [
|
|
28
|
-
{
|
|
29
|
-
"codeblock": {
|
|
30
|
-
"tabs": [
|
|
31
|
-
{
|
|
32
|
-
"title": "graphql",
|
|
33
|
-
"language": "graphql",
|
|
34
|
-
"code": "mutation addBook ($bookInput: BookInput) {\n addBook (bookInput: $bookInput)\n}"
|
|
35
|
-
}
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
]
|
|
42
|
-
},
|
|
43
|
-
"definitions": [
|
|
44
|
-
{
|
|
45
|
-
"title": "Arguments",
|
|
46
|
-
"properties": [
|
|
47
|
-
{
|
|
48
|
-
"name": "bookInput",
|
|
49
|
-
"type": "BookInput",
|
|
50
|
-
"description": "",
|
|
51
|
-
"properties": [
|
|
52
|
-
{
|
|
53
|
-
"name": "title",
|
|
54
|
-
"type": "String!",
|
|
55
|
-
"description": "",
|
|
56
|
-
"properties": []
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"name": "author",
|
|
60
|
-
"type": "String!",
|
|
61
|
-
"description": "",
|
|
62
|
-
"properties": []
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
]
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
"title": "Returns",
|
|
70
|
-
"properties": []
|
|
71
|
-
}
|
|
72
|
-
]
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"title": "BookInput",
|
|
76
|
-
"description": "",
|
|
77
|
-
"canonical": "BookInput",
|
|
78
|
-
"context": {
|
|
79
|
-
"graphqlName": "BookInput",
|
|
80
|
-
"graphqlType": "input"
|
|
81
|
-
},
|
|
82
|
-
"definitions": [
|
|
83
|
-
{
|
|
84
|
-
"title": "Fields",
|
|
85
|
-
"properties": [
|
|
86
|
-
{
|
|
87
|
-
"name": "title",
|
|
88
|
-
"type": "String!",
|
|
89
|
-
"description": "",
|
|
90
|
-
"properties": []
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
"name": "author",
|
|
94
|
-
"type": "String!",
|
|
95
|
-
"description": "",
|
|
96
|
-
"properties": []
|
|
97
|
-
}
|
|
98
|
-
]
|
|
99
|
-
}
|
|
100
|
-
],
|
|
101
|
-
"examples": {
|
|
102
|
-
"groups": []
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
]
|
|
106
|
-
|
|
107
|
-
expect(references).toEqual(equal)
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
it('0.not-required', async () => {
|
|
111
|
-
const schemaLocation = path.join(process.cwd(), "./examples/nested/nested-arg.0.not-required.graphqls")
|
|
112
|
-
|
|
113
|
-
const references = await gqlSchemaToReferences(schemaLocation)
|
|
114
|
-
|
|
115
|
-
const equal = [
|
|
116
|
-
{
|
|
117
|
-
"title": "addBook",
|
|
118
|
-
"canonical": "addBook",
|
|
119
|
-
"description": "",
|
|
120
|
-
"category": "graphql",
|
|
121
|
-
"type": "graphql_mutation",
|
|
122
|
-
"examples": {
|
|
123
|
-
"groups": [
|
|
124
|
-
{
|
|
125
|
-
"description": "Example request",
|
|
126
|
-
"examples": [
|
|
127
|
-
{
|
|
128
|
-
"codeblock": {
|
|
129
|
-
"tabs": [
|
|
130
|
-
{
|
|
131
|
-
"title": "graphql",
|
|
132
|
-
"language": "graphql",
|
|
133
|
-
"code": "mutation addBook ($bookInput: BookInput) {\n addBook (bookInput: $bookInput)\n}"
|
|
134
|
-
}
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
]
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
},
|
|
142
|
-
"definitions": [
|
|
143
|
-
{
|
|
144
|
-
"title": "Arguments",
|
|
145
|
-
"properties": [
|
|
146
|
-
{
|
|
147
|
-
"name": "bookInput",
|
|
148
|
-
"type": "BookInput",
|
|
149
|
-
"description": "",
|
|
150
|
-
"properties": [
|
|
151
|
-
{
|
|
152
|
-
"name": "title",
|
|
153
|
-
"type": "String!",
|
|
154
|
-
"description": "",
|
|
155
|
-
"properties": []
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
"name": "author",
|
|
159
|
-
"type": "String!",
|
|
160
|
-
"description": "",
|
|
161
|
-
"properties": []
|
|
162
|
-
}
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
]
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
"title": "Returns",
|
|
169
|
-
"properties": []
|
|
170
|
-
}
|
|
171
|
-
]
|
|
172
|
-
},
|
|
173
|
-
{
|
|
174
|
-
"title": "BookInput",
|
|
175
|
-
"description": "",
|
|
176
|
-
"canonical": "BookInput",
|
|
177
|
-
"context": {
|
|
178
|
-
"graphqlName": "BookInput",
|
|
179
|
-
"graphqlType": "input"
|
|
180
|
-
},
|
|
181
|
-
"definitions": [
|
|
182
|
-
{
|
|
183
|
-
"title": "Fields",
|
|
184
|
-
"properties": [
|
|
185
|
-
{
|
|
186
|
-
"name": "title",
|
|
187
|
-
"type": "String!",
|
|
188
|
-
"description": "",
|
|
189
|
-
"properties": []
|
|
190
|
-
},
|
|
191
|
-
{
|
|
192
|
-
"name": "author",
|
|
193
|
-
"type": "String!",
|
|
194
|
-
"description": "",
|
|
195
|
-
"properties": []
|
|
196
|
-
}
|
|
197
|
-
]
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
"examples": {
|
|
201
|
-
"groups": []
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
]
|
|
205
|
-
|
|
206
|
-
expect(references).toEqual(equal)
|
|
207
|
-
})
|
|
208
|
-
})
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
|
|
3
|
-
import {beforeEach, describe, expect, it} from 'vitest'
|
|
4
|
-
|
|
5
|
-
import {gqlSchemaToReferences} from "../src";
|
|
6
|
-
|
|
7
|
-
describe('nested-arg', async () => {
|
|
8
|
-
beforeEach(() => {
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
it('1.deep', async () => {
|
|
12
|
-
const schemaLocation = path.join(process.cwd(), "./examples/nested/nested-arg.1.deep.graphqls")
|
|
13
|
-
|
|
14
|
-
const references = await gqlSchemaToReferences(schemaLocation)
|
|
15
|
-
|
|
16
|
-
// console.log(JSON.stringify(references, null, 2))
|
|
17
|
-
// expect(references).toEqual()
|
|
18
|
-
})
|
|
19
|
-
})
|