(buildForType ? : string)
| 55 | } |
| 56 | |
| 57 | code(buildForType ? : string): string { |
| 58 | |
| 59 | if (!buildForType) |
| 60 | return this.schema(this.document); |
| 61 | |
| 62 | const directive = this.document |
| 63 | .directives |
| 64 | .find((directive) => directive.name === (buildForType as string)); |
| 65 | |
| 66 | if (directive) |
| 67 | return this.directive(directive); |
| 68 | |
| 69 | const type = this.document |
| 70 | .types |
| 71 | .find((type) => type.name === (buildForType as string)); |
| 72 | |
| 73 | if (type) { |
| 74 | switch (type.kind) { |
| 75 | |
| 76 | case SCALAR: |
| 77 | return this.scalar(type); |
| 78 | |
| 79 | case OBJECT: |
| 80 | return this.object(type); |
| 81 | |
| 82 | case INTERFACE: |
| 83 | return this.interfaces(type); |
| 84 | |
| 85 | case UNION: |
| 86 | return this.union(type); |
| 87 | |
| 88 | case ENUM: |
| 89 | return this.enum(type); |
| 90 | |
| 91 | case INPUT_OBJECT: |
| 92 | return this.inputObject(type); |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | throw new TypeError('Unexpected type: ' + buildForType); |
| 97 | } |
| 98 | |
| 99 | argument(arg: InputValue): string { |
| 100 |
no test coverage detected