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
Copy file name to clipboardExpand all lines: README.md
+12-6Lines changed: 12 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,11 @@
2
2
3
3
# GraphQL Generator for Swift
4
4
5
-
A Swift package plugin that generates server-side GraphQL API code from GraphQL schema files, inspired by [GraphQL Tools' makeExecutableSchema](https://the-guild.dev/graphql/tools/docs/generate-schema) and [Swift's OpenAPI Generator](https://github.com/apple/swift-openapi-generator).
5
+
This is a Swift package plugin that generates server-side GraphQL API code from GraphQL schema files, inspired by [GraphQL Tools' makeExecutableSchema](https://the-guild.dev/graphql/tools/docs/generate-schema) and [Swift's OpenAPI Generator](https://github.com/apple/swift-openapi-generator).
6
6
7
7
## Features
8
8
9
-
-**Data-driven**: Guarantee conformance with declared GraphQL spec
9
+
-**Data-driven**: Guarantee conformance with the declared GraphQL spec
10
10
-**Build-time code generation**: Code is generated at build time and doesn't need to be committed
11
11
-**Type-safe**: Leverages Swift's type system for compile-time safety
12
12
-**Minimal boilerplate**: Generates all GraphQL definition code - you write the business logic
@@ -37,6 +37,8 @@ targets: [
37
37
38
38
## Quick Start
39
39
40
+
*Protip*: Take a look at the projects in the `Examples` directory to see real, fully featured examples.
41
+
40
42
### 1. Create a GraphQL Schema
41
43
42
44
Create a `.graphql` file in your target's `Sources` directory:
- `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.
61
63
- `GraphQLTypes.swift` - Swift protocols and types for your GraphQL types. These are all namespaced within `GraphQLGenerated`.
@@ -72,7 +74,7 @@ actor GraphQLContext {
72
74
73
75
If your schema has any custom scalar types, you must create them manually in the `GraphQLScalars` namespace. See the `Scalars` usage section below for details.
74
76
75
-
Create a resolvers struct with the required typealiases:
77
+
Create a struct that conforms to `GraphQLGenerated.Resolvers` by defining the required typealiases:
0 commit comments