Skip to content

Commit 5268a81

Browse files
docs: Documentation updates
1 parent 0e4881d commit 5268a81

3 files changed

Lines changed: 9 additions & 393 deletions

File tree

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,17 @@
22

33
# GraphQL Generator for Swift
44

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).
6-
7-
This tool uses [GraphQL Swift](https://github.com/GraphQLSwift/GraphQL) to generate type-safe Swift code and protocol stubs from your GraphQL schema files, eliminating boilerplate while allowing you full control over your business logic.
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).
86

97
## Features
108

11-
- **Build-time code generation**: Code is generated at build time and never needs to be committed
9+
- **Build-time code generation**: Code is generated at build time and doesn't need to be committed
1210
- **Type-safe**: Leverages Swift's type system for compile-time safety
13-
- **Framework-agnostic**: Generated code works with any Swift server framework (Vapor, Hummingbird, etc.)
14-
- **Modern Swift**: Uses async/await for all resolver functions
15-
- **Minimal boilerplate**: Generates only ceremony code - you write the business logic
11+
- **Minimal boilerplate**: Generates all GraphQL definition code - you write the business logic
1612

1713
## Installation
1814

19-
Add the package to your `Package.swift`:
15+
Add the package to your `Package.swift`. Be sure to add the `GraphQLGeneratorRuntime` dependency to your package, and add the `GraphQLGeneratorPlugin` to the plugins section:
2016

2117
```swift
2218
dependencies: [
@@ -78,10 +74,11 @@ Create a resolvers struct with the required typealiases:
7874
struct Resolvers: ResolversProtocol {
7975
typealias Query = ExamplePackage.Query
8076
typealias Mutation = ExamplePackage.Mutation
77+
typealias Subscription = ExamplePackage.Subscription
8178
}
8279
```
8380

84-
As you build the `Query` and `Mutation` types and their resolution logic, you will be forced to define a concrete type for every reachable GraphQL result, according to its generated protocol:
81+
As you build the `Query`, `Mutation`, and `Subscription` types and their resolution logic, you will be forced to define a concrete type for every reachable GraphQL result, according to its generated protocol:
8582

8683
```swift
8784
struct Query: QueryProtocol {
@@ -218,9 +215,9 @@ public struct EmailAddress: Scalar {
218215
## Development Roadmap
219216

220217
1. Directives: Directives are currently not supported
221-
2. Subscription: Subscription definitions are currently ignored
222-
3. Improved testing: Generator tests should cover much more of the functionality
223-
4. Additional examples: Ideally large ones that cover significant GraphQL features
218+
2. Improved testing: Generator tests should cover much more of the functionality
219+
3. Additional examples: Ideally large ones that cover significant GraphQL features
220+
4. Enhanced configuration: There should be configuration options for the build plugin itself
224221
5. Executable Schema: To work around the immutability of some Schema components, we generate Swift code to fully recreate the defined schema. Instead, we could just add resolver logic to the schema parsed from the `.graphql` file SDL.
225222

226223
## Contributing

Sources/GraphQLGeneratorCore/Generator/TypeGenerator.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package struct TypeGenerator {
1717
"""
1818

1919
// Generate ResolversProtocol
20-
2120
output += """
2221
2322
public protocol ResolversProtocol: Sendable {

0 commit comments

Comments
 (0)