|
5 | 5 |
|
6 | 6 | 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). |
7 | 7 |
|
8 | | -## Features |
| 8 | +Using this package has the following benefits: |
| 9 | +- Guarantees conformance with the declared GraphQL spec |
| 10 | +- Leverages Swift's type system for compile-time safety |
| 11 | +- Flexiblity in backing data types |
| 12 | +- Generates all the piping between Swift and GraphQL - you just write the resolvers |
9 | 13 |
|
10 | | -- **Data-driven**: Guarantee conformance with the declared GraphQL spec |
11 | | -- **Type-safe**: Leverages Swift's type system for compile-time safety |
12 | | -- **Flexible implementation**: Makes no assumptions about backing data types other than GraphQL type conformance |
13 | | -- **Minimal boilerplate**: Generates all the piping between Swift and GraphQL - you just write the resolvers |
| 14 | +To expose your schema through HTTP, check out [graphql-vapor](https://github.com/GraphQLSwift/graphql-vapor) or [graphql-hummingbird](https://github.com/GraphQLSwift/graphql-hummingbird). To define your schema in native Swift, use [Graphiti](https://github.com/GraphQLSwift/Graphiti) instead. |
14 | 15 |
|
15 | | -## Installation |
16 | | - |
17 | | -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: |
18 | | - |
19 | | -```swift |
20 | | -dependencies: [ |
21 | | - .package(url: "https://github.com/GraphQLSwift/GraphQL.git", from: "4.1.0"), |
22 | | - .package(url: "https://github.com/GraphQLSwift/graphql-generator", from: "1.0.0") |
23 | | -], |
24 | | -targets: [ |
25 | | - .target( |
26 | | - name: "YourTarget", |
27 | | - dependencies: [ |
28 | | - .product(name: "GraphQL", package: "GraphQL"), |
29 | | - .product(name: "GraphQLGeneratorRuntime", package: "graphql-generator"), |
30 | | - ], |
31 | | - plugins: [ |
32 | | - .plugin(name: "GraphQLGeneratorPlugin", package: "graphql-generator") |
33 | | - ] |
34 | | - ) |
35 | | -] |
36 | | -``` |
37 | | - |
38 | | -## Quick Start |
| 16 | +## Usage |
39 | 17 |
|
40 | 18 | Take a look at the example projects to see real, fully featured implementations: |
41 | 19 | - [HelloWorldServer](Examples/HelloWorldServer) - Demonstrates all GraphQL type mappings with a comprehensive schema |
|
0 commit comments