prismake / typegql

Create GraphQL schema with TypeScript classes.
https://prismake.github.io/typegql/
MIT License
423 stars 21 forks source link

Added option to set multiple roots to compileSchema #21

Closed pie6k closed 6 years ago

pie6k commented 6 years ago

This branch allows adding multiple roots to compileSchema allowing things like:

@SchemaRoot()
class FooSchema {
  @Query()
  foo(): string {
    return 'foo';
  }
}

@SchemaRoot()
class BarSchema {
  @Mutation()
  bar(): number {
    return 42;
  }
}

const schema = compileSchema({ roots: [FooSchema, BarSchema] });

It's still allowing creating schema 'old way' with compileSchema(SchemaClass); but it'll show deprecation warning.

codecov[bot] commented 6 years ago

Codecov Report

Merging #21 into master will decrease coverage by 0.41%. The diff coverage is 92.06%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #21      +/-   ##
==========================================
- Coverage   87.33%   86.92%   -0.42%     
==========================================
  Files          61       62       +1     
  Lines        1058     1086      +28     
  Branches      181      188       +7     
==========================================
+ Hits          924      944      +20     
- Misses        133      141       +8     
  Partials        1        1
Impacted Files Coverage Δ
src/domains/field/compiler/services.ts 88.88% <ø> (ø) :arrow_up:
src/domains/schema/error.ts 75% <0%> (ø) :arrow_up:
src/services/utils/index.ts 100% <100%> (ø) :arrow_up:
src/domains/schema/rootFields.ts 92.59% <100%> (ø) :arrow_up:
src/domains/schema/registry.ts 100% <100%> (ø) :arrow_up:
src/services/utils/deprecation/index.ts 100% <100%> (ø)
src/domains/index.ts 100% <100%> (ø) :arrow_up:
src/domains/schema/index.ts 85% <76.92%> (-15%) :arrow_down:
src/domains/schema/compiler.ts 94.59% <95.65%> (+2.28%) :arrow_up:
src/services/utils/mapObject.ts 33.33% <0%> (-55.56%) :arrow_down:
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 9bed763...80448bc. Read the comment docs.