File tree Expand file tree Collapse file tree 4 files changed +41
-38
lines changed Expand file tree Collapse file tree 4 files changed +41
-38
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ packages/schema/README.md
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @graphql-ts/extend" ,
3
3
"version" : " 1.0.0" ,
4
+ "description" : " Utilities to extend existing GraphQL schemas with @graphql-ts/schema" ,
4
5
"main" : " dist/graphql-ts-extend.cjs.js" ,
5
6
"module" : " dist/graphql-ts-extend.esm.js" ,
6
7
"exports" : {
Original file line number Diff line number Diff line change
1
+ # @graphql-ts/schema
2
+
3
+ ` @graphql-ts/schema ` is a thin wrapper around
4
+ [ GraphQL.js] ( https://github.com/graphql/graphql-js ) providing type-safety for
5
+ constructing GraphQL Schemas while avoiding type-generation, [ declaration merging] ( https://www.typescriptlang.org/docs/handbook/declaration-merging.html )
6
+ and [ decorators] ( https://www.typescriptlang.org/docs/handbook/decorators.html ) .
7
+
8
+ ``` ts
9
+ import { graphql } from " @graphql-ts/schema" ;
10
+ import { GraphQLSchema , graphql as runGraphQL } from " graphql" ;
11
+
12
+ const Query = graphql .object ()({
13
+ name: " Query" ,
14
+ fields: {
15
+ hello: graphql .field ({
16
+ type: graphql .String ,
17
+ resolve() {
18
+ return " Hello!" ;
19
+ },
20
+ }),
21
+ },
22
+ });
23
+
24
+ const schema = new GraphQLSchema ({
25
+ query: Query .graphQLType ,
26
+ });
27
+
28
+ runGraphQL ({
29
+ source: `
30
+ query {
31
+ hello
32
+ }
33
+ ` ,
34
+ schema ,
35
+ }).then ((result ) => {
36
+ console .log (result );
37
+ });
38
+ ```
Original file line number Diff line number Diff line change 1
1
{
2
2
"name" : " @graphql-ts/schema" ,
3
3
"version" : " 0.6.0" ,
4
+ "description" : " Type-safety for constructing GraphQL schemas in TypeScript" ,
4
5
"main" : " dist/graphql-ts-schema.cjs.js" ,
5
6
"module" : " dist/graphql-ts-schema.esm.js" ,
6
7
"exports" : {
You can’t perform that action at this time.
0 commit comments