You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`compiledSchema` from example above is standard, regular `graphql` schema.
30
30
31
-
You can also pass an array of classes decorated with `@Schema`-any non trivial app will probably require more than one class to expose all it's API root logic.
31
+
You can also pass an array of classes decorated with `@SchemaRoot`-any non trivial app will probably require more than one class to expose all it's API root logic.
32
32
33
33
## Adding Query and Mutation fields
34
34
@@ -45,9 +45,9 @@ Very simple fully working schema like
45
45
Could be implemented as:
46
46
47
47
```js
48
-
import { Schema, Query, compileSchema} from 'decapi
48
+
import { SchemaRoot, Query, compileSchema} from 'decapi
49
49
50
-
@Schema()
50
+
@SchemaRoot()
51
51
class SuperSchema {
52
52
@Query()
53
53
hello(): string {
@@ -71,9 +71,9 @@ Let's add some customization to our schema:
71
71
With tiny change in our code:
72
72
73
73
```js
74
-
import { Schema, Query, compileSchema} from 'decapi
74
+
import { SchemaRoot, Query, compileSchema} from 'decapi
75
75
76
-
@Schema()
76
+
@SchemaRoot()
77
77
classSuperSchema {
78
78
@Query()
79
79
hello(name: string): string {
@@ -101,7 +101,7 @@ mutation {
101
101
Such query will have a bit more code and here it is:
`"@ObjectType Hello.world: Field type was infered as \\"function Promise() { [native code] }\\" so it's required to explicitly set the type as it's not possible to guess it. Pass it in a config for the field like: @Field({ type: ItemType })"`
188
+
)
179
189
})
180
190
181
191
it('should support schema root instance properties',async()=>{
Copy file name to clipboardExpand all lines: src/domains/schema/__snapshots__/SchemaRoot.spec.ts.snap
-10
Original file line number
Diff line number
Diff line change
@@ -968,13 +968,3 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
968
968
},
969
969
}
970
970
`;
971
-
972
-
exports[`@SchemaRoot should not allow @Schema without any @Query field 1`] =`"At least one of schema roots must have @Query root field."`;
973
-
974
-
exports[`@SchemaRoot should not allow compiling schema not decorated with @Schema 1`] =`"@Schema Foo: Schema root must be registered with @SchemaRoot"`;
975
-
976
-
exports[`@SchemaRoot should not allow schema that has only mutation fields 1`] =`"At least one of schema roots must have @Query root field."`;
977
-
978
-
exports[`@SchemaRoot will not allow multiple schema roots to have conflicting root field names 1`] =`"@Schema BarSchema: Duplicate of root field name: 'foo'. Seems this name is also used inside other schema root."`;
979
-
980
-
exports[`@SchemaRoot will not allow schema with incorrect object types 1`] =`"@ObjectType Hello.world: Field type was infered as \\"function Promise() { [nativecode] }\\" so it's required to explicitly set the type as it's not possible to guess it. Pass it in a config for the field like: @Field({type: ItemType})"`;
0 commit comments