File tree Expand file tree Collapse file tree
Sources/GraphQLGeneratorCore/Generator Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,9 +27,9 @@ struct GraphQLGeneratorPlugin: BuildToolPlugin {
2727 let schemaInputs = schemaFiles. map ( \. url)
2828
2929 let outputFiles = [
30- outputDirectory. appendingPathComponent ( " Types .swift" ) ,
31- outputDirectory. appendingPathComponent ( " Schema .swift" ) ,
32- outputDirectory. appendingPathComponent ( " SDL .swift" ) ,
30+ outputDirectory. appendingPathComponent ( " BuildGraphQLSchema .swift" ) ,
31+ outputDirectory. appendingPathComponent ( " GraphQLRawSDL .swift" ) ,
32+ outputDirectory. appendingPathComponent ( " GraphQLTypes .swift" ) ,
3333 ]
3434
3535 let arguments = schemaInputs. flatMap { [ " \( $0. path) " ] } + [
Original file line number Diff line number Diff line change @@ -53,9 +53,10 @@ type Query {
5353
5454### 2. Build Your Project
5555
56- When you build , the plugin will automatically generate Swift code :
57- - `Types .swift ` - Swift protocols and types for your GraphQL types . These are all namespaced within `GraphQLGenerated `.
58- - `Schema .swift ` - Defines `buildGraphQLSchema ` function that builds an executable schema
56+ When you build , the plugin will automatically generate Swift code that you can view in the `.build /plugins /outputs ` directory :
57+ - `BuildGraphQLSchema .swift ` - Defines `buildGraphQLSchema ` function that builds an executable schema .
58+ - `GraphQLRawSDL.swift` - The `graphQLRawSDL` global property, which is a Swift string literal of the input schema. This is internally used at runtime to parse the schema.
59+ - `GraphQLTypes.swift` - Swift protocols and types for your GraphQL types. These are all namespaced within `GraphQLGenerated`.
5960
6061### 3. Create required types
6162
Original file line number Diff line number Diff line change @@ -11,18 +11,9 @@ package struct CodeGenerator {
1111 let schema = try GraphQL . buildSchema ( source: source)
1212
1313 var files : [ String : String ] = [ : ]
14-
15- // Generate Types.swift
16- let typeGenerator = TypeGenerator ( )
17- files [ " Types.swift " ] = try typeGenerator. generate ( schema: schema)
18-
19- // Generate Schema.swift
20- let schemaGenerator = SchemaGenerator ( )
21- files [ " Schema.swift " ] = try schemaGenerator. generate ( schema: schema)
22-
23- // Generate SDL.swift
24- let sdlGenerator = SDLGenerator ( )
25- files [ " SDL.swift " ] = try sdlGenerator. generate ( source: source)
14+ files [ " BuildGraphQLSchema.swift " ] = try SchemaGenerator ( ) . generate ( schema: schema)
15+ files [ " GraphQLRawSDL.swift " ] = try SDLGenerator ( ) . generate ( source: source)
16+ files [ " GraphQLTypes.swift " ] = try TypeGenerator ( ) . generate ( schema: schema)
2617
2718 return files
2819 }
You can’t perform that action at this time.
0 commit comments