-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcodegen.schema.yml
58 lines (52 loc) · 1.86 KB
/
codegen.schema.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
schema:
- ${RAZZLE_API_BASE_URL}/graphql:
loader: ./src/api/schema/client-schema.graphql-loader.ts
overwrite: true
config:
# Use `import type` which should be default for TS 3.8+
useTypeImports: true
# Immutability is great, but Apollo also enforces this at runtime (at least in dev)
# so this ensures that invalid code is caught before runtime.
immutableTypes: true
generates:
# Generate schema file so IDEs can autocomplete graphql documents
./schema.graphql:
plugins:
- schema-ast
# Generate fragment matcher for Apollo's caching
./src/api/schema/fragmentMatcher/fragmentMatcher.generated.ts:
plugins:
- ./src/api/schema/fragmentMatcher/fragmentMatcher.codegen
# Generate type policies automatically specific to our API
./src/api/schema/typePolicies/typePolicies.generated.ts:
plugins:
- ./src/api/schema/typePolicies/typePolicies.codegen
# Generate lists for all of our enums
./src/api/schema/enumLists/enumLists.generated.ts:
plugins:
- ./src/api/schema/enumLists/enumLists.codegen
# Generate a type map for all of our GQL object types
./src/api/schema/typeMap/typeMap.generated.ts:
plugins:
- ./src/api/schema/typeMap/typeMap.codegen
# Generate TypeScript version of graphql schema
./src/api/schema/schema.graphql.ts:
plugins:
- typescript
- add:
placement: prepend
content: |
import { DateTime } from 'luxon';
import { CalendarDate, RichTextJson, MarkdownString, InlineMarkdownString } from '~/common';
config:
scalars:
Date: CalendarDate
DateTime: DateTime
JSONObject: Record<string, any>
URL: string
RichText: RichTextJson
Markdown: MarkdownString
InlineMarkdown: InlineMarkdownString
defaultScalarType: unknown
skipTypename: false
enumsAsTypes: true