Skip to content

Commit

Permalink
Upgrade to Vapor 4 (without Fluent support yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsteinerde committed Mar 1, 2020
1 parent 71e2603 commit 2e6a918
Show file tree
Hide file tree
Showing 8 changed files with 167 additions and 209 deletions.
168 changes: 66 additions & 102 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -2,102 +2,75 @@
"object": {
"pins": [
{
"package": "Console",
"repositoryURL": "https://github.com/vapor/console.git",
"package": "async-http-client",
"repositoryURL": "https://github.com/swift-server/async-http-client.git",
"state": {
"branch": null,
"revision": "74cfbea629d4aac34a97cead2447a6870af1950b",
"version": "3.1.1"
"revision": "e2636a4c24e646d3e480fc666da0c090818beb09",
"version": "1.1.0"
}
},
{
"package": "Core",
"repositoryURL": "https://github.com/vapor/core.git",
"package": "async-kit",
"repositoryURL": "https://github.com/vapor/async-kit.git",
"state": {
"branch": null,
"revision": "10d33362a47fab03a067e78fb0791341d9c634fa",
"version": "3.9.3"
"revision": "42edd5d6b52afc0678f85d4a67aa79e0be79fba5",
"version": "1.0.0-beta.2.6"
}
},
{
"package": "CRuntime",
"repositoryURL": "https://github.com/wickwirew/CRuntime.git",
"package": "console-kit",
"repositoryURL": "https://github.com/vapor/console-kit.git",
"state": {
"branch": null,
"revision": "95f911318d8c885f6fc05e971471f94adfd39405",
"version": "2.1.2"
"revision": "a10418160fd4d2af183b0a754a93373734d6ba80",
"version": "4.0.0-beta.2.3"
}
},
{
"package": "Crypto",
"repositoryURL": "https://github.com/vapor/crypto.git",
"state": {
"branch": null,
"revision": "df8eb7d8ae51787b3a0628aa3975e67666da936c",
"version": "3.3.3"
}
},
{
"package": "DatabaseKit",
"repositoryURL": "https://github.com/vapor/database-kit.git",
"state": {
"branch": null,
"revision": "8f352c8e66dab301ab9bfef912a01ce1361ba1e4",
"version": "1.3.3"
}
},
{
"package": "Fluent",
"repositoryURL": "https://github.com/vapor/fluent.git",
"package": "CRuntime",
"repositoryURL": "https://github.com/wickwirew/CRuntime.git",
"state": {
"branch": null,
"revision": "783819d8838d15e1a05b459aa0fd1bde1e37ac26",
"version": "3.2.1"
"revision": "95f911318d8c885f6fc05e971471f94adfd39405",
"version": "2.1.2"
}
},
{
"package": "Graphiti",
"repositoryURL": "https://github.com/alexsteinerde/Graphiti.git",
"state": {
"branch": null,
"revision": "a44c615d9f1632fe403d7c9721d33cc7ce684b4c",
"version": "0.12.1"
"revision": "fd61913593ea49c85bbe74af152cb123fe7998e8",
"version": "0.13.0-beta.1"
}
},
{
"package": "GraphQL",
"repositoryURL": "https://github.com/alexsteinerde/GraphQL.git",
"state": {
"branch": null,
"revision": "be0d2940c1a91e8b6f4de091a27c12d0f513d83f",
"version": "0.12.1"
"revision": "e55495ded126bf48d7696fe5a4ec67bccb86838b",
"version": "0.13.0-beta.1"
}
},
{
"package": "HTTP",
"repositoryURL": "https://github.com/vapor/http.git",
"package": "multipart-kit",
"repositoryURL": "https://github.com/vapor/multipart-kit.git",
"state": {
"branch": null,
"revision": "3808ed0401379b6e9f4a053f03090ea9d658caa9",
"version": "3.2.1"
"revision": "b41a49b5756ac3fbf8f2b07228a7e75f9b60731a",
"version": "4.0.0-beta.2"
}
},
{
"package": "Multipart",
"repositoryURL": "https://github.com/vapor/multipart.git",
"package": "routing-kit",
"repositoryURL": "https://github.com/vapor/routing-kit.git",
"state": {
"branch": null,
"revision": "f063180d0b84832accd33194e06ed3c41f8609ac",
"version": "3.1.1"
}
},
{
"package": "Routing",
"repositoryURL": "https://github.com/vapor/routing.git",
"state": {
"branch": null,
"revision": "d76f339c9716785e5079af9d7075d28ff7da3d92",
"version": "3.1.0"
"revision": "9eccd8152a66db98c188e74242c686971a007211",
"version": "4.0.0-beta.3.1"
}
},
{
Expand All @@ -110,102 +83,93 @@
}
},
{
"package": "Service",
"repositoryURL": "https://github.com/vapor/service.git",
"state": {
"branch": null,
"revision": "fa5b5de62bd68bcde9a69933f31319e46c7275fb",
"version": "1.0.2"
}
},
{
"package": "SQL",
"repositoryURL": "https://github.com/vapor/sql.git",
"package": "swift-backtrace",
"repositoryURL": "https://github.com/ianpartridge/swift-backtrace.git",
"state": {
"branch": null,
"revision": "50eaeb8f52a1ce63f1ff3880e1114dd8757a78a6",
"version": "2.3.2"
"revision": "eaf2cef011c0c23d1701aa60b364def8015dc3c7",
"version": "1.1.1"
}
},
{
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"package": "swift-crypto",
"repositoryURL": "https://github.com/apple/swift-crypto.git",
"state": {
"branch": null,
"revision": "ba7970fe396e8198b84c6c1b44b38a1d4e2eb6bd",
"version": "1.14.1"
"revision": "9be4a93a76d4b80105044747b35d456de7289c87",
"version": "1.0.0"
}
},
{
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"package": "swift-log",
"repositoryURL": "https://github.com/apple/swift-log.git",
"state": {
"branch": null,
"revision": "0f3999f3e3c359cc74480c292644c3419e44a12f",
"version": "1.4.0"
"revision": "74d7b91ceebc85daf387ebb206003f78813f71aa",
"version": "1.2.0"
}
},
{
"package": "swift-nio-ssl-support",
"repositoryURL": "https://github.com/apple/swift-nio-ssl-support.git",
"package": "swift-metrics",
"repositoryURL": "https://github.com/apple/swift-metrics.git",
"state": {
"branch": null,
"revision": "c02eec4e0e6d351cd092938cf44195a8e669f555",
"version": "1.0.0"
"revision": "09b72f68ed9b01b614c12855fc7e22876b97a97e",
"version": "1.2.1"
}
},
{
"package": "swift-nio-zlib-support",
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
"package": "swift-nio",
"repositoryURL": "https://github.com/apple/swift-nio.git",
"state": {
"branch": null,
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
"version": "1.0.0"
"revision": "16ab4d657e1ad4e77bd5f8b94af8538561643053",
"version": "2.14.0"
}
},
{
"package": "TemplateKit",
"repositoryURL": "https://github.com/vapor/template-kit.git",
"package": "swift-nio-extras",
"repositoryURL": "https://github.com/apple/swift-nio-extras.git",
"state": {
"branch": null,
"revision": "51405c83e95e8adb09565278a5e9b959c605e56c",
"revision": "b4dbfacff47fb8d0f9e0a422d8d37935a9f10570",
"version": "1.4.0"
}
},
{
"package": "URLEncodedForm",
"repositoryURL": "https://github.com/vapor/url-encoded-form.git",
"package": "swift-nio-http2",
"repositoryURL": "https://github.com/apple/swift-nio-http2.git",
"state": {
"branch": null,
"revision": "82d8d63bdb76b6dd8febe916c639ab8608dbbaed",
"version": "1.0.6"
"revision": "65ebab9db70623bf1b58305edaa26ee5629856ed",
"version": "1.9.1"
}
},
{
"package": "Validation",
"repositoryURL": "https://github.com/vapor/validation.git",
"package": "swift-nio-ssl",
"repositoryURL": "https://github.com/apple/swift-nio-ssl.git",
"state": {
"branch": null,
"revision": "4de213cf319b694e4ce19e5339592601d4dd3ff6",
"version": "2.1.1"
"revision": "af46d9b58fafbb76f9b01177568d435a1b024f99",
"version": "2.6.2"
}
},
{
"package": "Vapor",
"package": "vapor",
"repositoryURL": "https://github.com/vapor/vapor.git",
"state": {
"branch": null,
"revision": "92a58a9a84e4330500b99fe355a94d29f67abe58",
"version": "3.3.1"
"revision": "638dc5853bce8d830bb7e8cc12294242f5f9dd84",
"version": "4.0.0-beta.4.2"
}
},
{
"package": "WebSocket",
"repositoryURL": "https://github.com/vapor/websocket.git",
"package": "websocket-kit",
"repositoryURL": "https://github.com/vapor/websocket-kit.git",
"state": {
"branch": null,
"revision": "d85e5b6dce4d04065865f77385fc3324f98178f6",
"version": "1.1.2"
"revision": "670e757f21cc8f1f76a04baac72f72ea1590e18d",
"version": "2.0.0-beta.2.5"
}
}
]
Expand Down
13 changes: 8 additions & 5 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ import PackageDescription

let package = Package(
name: "GraphQLKit",
platforms: [
.macOS(.v10_15),
],
products: [
.library(
name: "GraphQLKit",
targets: ["GraphQLKit"]),
],
dependencies: [
.package(url: "https://github.com/alexsteinerde/Graphiti.git", from: "0.12.1"),
.package(url: "https://github.com/vapor/vapor.git", from: "3.0.0"),
.package(url: "https://github.com/vapor/fluent.git", from: "3.0.0"),
.package(url: "https://github.com/alexsteinerde/Graphiti.git", from: "0.13.0-beta"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.0.0-beta"),
// .package(url: "https://github.com/vapor/fluent.git", from: "4.0.0-beta"),
],
targets: [
.target(name: "GraphQLKit", dependencies: ["Vapor", "Graphiti", "Fluent"]),
.testTarget(name: "GraphQLKitTests",dependencies: ["GraphQLKit"]),
.target(name: "GraphQLKit", dependencies: ["Vapor", "Graphiti"]),
.testTarget(name: "GraphQLKitTests",dependencies: ["GraphQLKit", "XCTVapor"]),
]
)
14 changes: 5 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# GraphQLKit
[![Language](https://img.shields.io/badge/Swift-5.1-brightgreen.svg)](http://swift.org)
[![Vapor Version](https://img.shields.io/badge/Vapor-3-F6CBCA.svg)](http://vapor.codes)
[![Vapor Version](https://img.shields.io/badge/Vapor-4-F6CBCA.svg)](http://vapor.codes)
[![build](https://github.com/alexsteinerde/graphql-kit/workflows/build/badge.svg)](https://github.com/alexsteinerde/graphql-kit/actions)


Expand All @@ -24,7 +24,7 @@ let package = Package(
.package(url: "https://github.com/alexsteinerde/graphql-kit.git", from: "1.0.0"),
],
targets: [
.target(name: "App", dependencies: [<#T##Other Dependencies#>, "GraphQLKit"]),
.target(name: "App", dependencies: ["GraphQLKit"]),
...
]
)
Expand Down Expand Up @@ -84,16 +84,12 @@ final class User {
Field(.user, with: \.user),
```

### Register the schema on the router
In your configure.swift file call the `register(graphQLSchema: <#T##Schema<FieldKeyProvider, Request>#>, withResolver: <#T##FieldKeyProvider#>)`. By default this registers the GET and POST endpoints at `/graphql`. But you can also pass the optional parameter `at:` and override the default value.
### Register the schema on the application
In your configure.swift file call the `register(graphQLSchema: <#T##Schema<FieldKeyProvider, Request>#>, withResolver: <#T##FieldKeyProvider#>)` on your `Application` instance. By default this registers the GET and POST endpoints at `/graphql`. But you can also pass the optional parameter `at:` and override the default value.

```Swift
let router = EngineRouter.default()

// Register the schema and it's resolver.
router.register(graphQLSchema: todoSchema, withResolver: TodoAPI())

services.register(router, as: Router.self)
app.register(graphQLSchema: todoSchema, withResolver: TodoAPI())
```

## License
Expand Down
6 changes: 5 additions & 1 deletion Sources/GraphQLKit/GraphQLError+Debuggabe.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import GraphQL
import Vapor

extension GraphQLError: Debuggable {
extension GraphQLError: AbortError {
public var status: HTTPResponseStatus {
return .ok
}

public var identifier: String {
"GraphQLError"
}
Expand Down
Loading

0 comments on commit 2e6a918

Please sign in to comment.