Skip to content

Commit

Permalink
Merge pull request #75 from d-exclaimation/doc-update-9
Browse files Browse the repository at this point in the history
Update Documentation to v0.9.0
  • Loading branch information
d-exclaimation authored Jul 16, 2022
2 parents 92bce97 + ebbd7bd commit c273d4b
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Documentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ You can add Pioneer into any existing Vapor application with any GraphQL schema
Add this line to add Pioneer as one of your dependencies.

```swift
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.8.6")
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.9.0")
```

Go to the `main.swift` or any Swift file where you apply your Vapor routing like your `routes.swift` file.
Expand Down
2 changes: 1 addition & 1 deletion Documentation/features/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ order: 50
# Configuration

!!!success Custom Configuration options
From `0.8.6`, Pioneer brought in a structure that will allow easier configuration, which would only require you to pass in the config object into [Pioneer](/references/pioneer) initializer.
From `0.9.0`, Pioneer brought in a structure that will allow easier configuration, which would only require you to pass in the config object into [Pioneer](/references/pioneer) initializer.
!!!

This configuration structure would allow user of the library to create multiple configuration for Pioneer on different environment or situation.
Expand Down
10 changes: 7 additions & 3 deletions Documentation/guides/advanced/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ No, there is no custom error from Pioneer (as of now), just use what works best

Mostly.

- If the error(s) were thrown during context building, Pioneer will use the reason to build a GraphQL formatted error and set the response status code accordingly.
- If the error(s) were thrown during context building, Pioneer will use the reason to build a GraphQL formatted error, and set the response status and headers code accordingly.
==- Example

```swift Throwing Abort
Expand Down Expand Up @@ -136,7 +136,7 @@ Mostly.

===

- If the error(s) were thrown in the resolver functions, Pioneer will only throw back a GraphQL formatted error with the description of the error thrown but will not set the response status (unless it was set manually into the response object during the resolving function).
- If the error(s) were thrown in the resolver functions, Pioneer will only throw back a GraphQL formatted error with the description of the error thrown but will not set the response status nor headers (unless it was set manually into the response object during the resolving function).

==- Example

Expand Down Expand Up @@ -173,7 +173,7 @@ Mostly.

### EventStream

#### Why does Pioneer only support `AsyncSequence` (and [AsyncEventStream](/features/async-event-stream/#asynceventstream))?
#### Why does Pioneer only support `AsyncSequence` (and to some extends [AsyncEventStream](/features/async-event-stream/#asynceventstream))?

This is a limitation when resolving subscription, where there is not much that can be done until the subscription result is casted to another type of `EventStream`. Pioneer uses the `AsyncEventStream` which can be built from any `AsyncSequence` because it is a built-in protocol from Swift Standard Library and other streaming libraries are likely to support it as well.

Expand All @@ -183,6 +183,10 @@ Not directly support [RxSwift](https://github.com/ReactiveX/RxSwift). However si

However, Pioneer is not compatible with [GraphQLRxSwift](https://github.com/GraphQLSwift/GraphQLRxSwift), and all [RxSwift](https://github.com/ReactiveX/RxSwift)'s observable must be converted into an `AsyncSequence`.

#### Does Pioneer support [ConcurrentEventStream](https://github.com/GraphQLSwift/GraphQL/blob/master/Sources/GraphQL/Subscription/EventStream.swift)?

Yes, [ConcurrentEventStream](https://github.com/GraphQLSwift/GraphQL/blob/master/Sources/GraphQL/Subscription/EventStream.swift) worked pratically the same as [AsyncEventStream](/features/async-event-stream/#asynceventstream), but limit itself to only `AsyncThrowingStream`.

### PubSub

#### Does Pioneer provide an [AsyncPubSub](/references/async-pubsub.md) that is backed by Redis?
Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides/getting-started/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let package = Package(
dependencies: [
.package(url: "https://github.com/GraphQLSwift/Graphiti.git", from: "1.0.0"),
.package(url: "https://github.com/vapor/vapor.git", from: "4.61.1"),
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.8.6")
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.9.0")
],
targets: [
.target(
Expand Down
72 changes: 72 additions & 0 deletions Documentation/references/enums.md
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,75 @@ Using this meant no operations nor even a websocket connection is going to be ac
!!!

|||

## Validations

Validation strategy to add custom rules that is executed before any resolver is executed

||| `none`

No rules, skip validation

|||

||| <code>specified(\_: [[ValidationRule](#validationrule)])</code>

Multiple constant rules

|||

||| <code>computed(\_: @Sendable ([GraphQLRequest](/references/structs/#graphqlrequest)) -> [[ValidationRule](#validationrule)])</code>

Cloud version of Banana Cake Pop

|||

### `init` (Array Literal)

Construct a new Validations from an array of [ValidationRule](#validationrule), equivalent to `.specified`

=== Example

```swift
let server = Pioneer(
schema: schema,
resolver: .init(),
contextBuilder: { req, res in
Context(req: req, res: res, auth: req.headers[.authorization].first)
},
validationRules: [MyValidationRule()]
)
```

===

==- Options

| Name | Type | Description |
| -------------- | --------------------------------------------------- | -------------------------- |
| `arrayLiteral` | [!badge variant="warning" text="ValidationRule..."] | An array of ValidationRule |

===

### `init` (Nil Literal)

Construct a new Validations from a nil, equivalent to `.none`

=== Example

```swift
let server = Pioneer(
schema: schema,
resolver: .init(),
contextBuilder: { req, res in
Context(req: req, res: res, auth: req.headers[.authorization].first)
},
validationRules: nil
)
```

===

### ValidationRule

Typealias for `@Sendable (ValidationContext) -> Visitor`
5 changes: 5 additions & 0 deletions Documentation/references/pioneer.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ let server = Pioneer(
| `websocketProtocol` | [!badge variant="primary" text="WebsocketProtocol"] | Websocket sub-protocol <br/> **Default**: `.subscriptionsTransportws` |
| `introspection` | [!badge variant="primary" text="Bool"] | Allowing introspection <br/> **Default**: `true` |
| `playground` | [!badge variant="primary" text="IDE"] | Allowing playground <br/> **Default**: `.graphiql` |
| `validationRules` | [!badge variant="primary" text="Validations"] | Validation rules to be applied before operation <br/> **Default**: `.none` |
| `keepAlive` | [!badge variant="warning" text="UInt64?"] | Keep alive internal in nanosecond, `nil` for disabling <br/> **Default**: 12.5 seconds |

===
Expand Down Expand Up @@ -85,6 +86,7 @@ let server = Pioneer(
| `websocketProtocol` | [!badge variant="primary" text="WebsocketProtocol"] | Websocket sub-protocol <br/> **Default**: `.subscriptionsTransportws` |
| `introspection` | [!badge variant="primary" text="Bool"] | Allowing introspection <br/> **Default**: `true` |
| `playground` | [!badge variant="primary" text="IDE"] | Allowing playground <br/> **Default**: `.graphiql` |
| `validationRules` | [!badge variant="primary" text="Validations"] | Validation rules to be applied before operation <br/> **Default**: `.none` |
| `keepAlive` | [!badge variant="warning" text="UInt64?"] | Keep alive internal in nanosecond, `nil` for disabling <br/> **Default**: 12.5 seconds |

===
Expand Down Expand Up @@ -120,6 +122,7 @@ let server = Pioneer(
| `websocketProtocol` | [!badge variant="primary" text="WebsocketProtocol"] | Websocket sub-protocol <br/> **Default**: `.subscriptionsTransportws` |
| `introspection` | [!badge variant="primary" text="Bool"] | Allowing introspection <br/> **Default**: `true` |
| `playground` | [!badge variant="primary" text="IDE"] | Allowing playground <br/> **Default**: `.graphiql` |
| `validationRules` | [!badge variant="primary" text="Validations"] | Validation rules to be applied before operation <br/> **Default**: `.none` |
| `keepAlive` | [!badge variant="warning" text="UInt64?"] | Keep alive internal in nanosecond, `nil` for disabling <br/> **Default**: 12.5 seconds |

===
Expand Down Expand Up @@ -159,6 +162,7 @@ let server = try Pioneer(
| `websocketProtocol` | [!badge variant="primary" text="WebsocketProtocol"] | Websocket sub-protocol <br/> **Default**: `.subscriptionsTransportws` |
| `introspection` | [!badge variant="primary" text="Bool"] | Allowing introspection <br/> **Default**: `true` |
| `playground` | [!badge variant="primary" text="IDE"] | Allowing playground <br/> **Default**: `.graphiql` |
| `validationRules` | [!badge variant="primary" text="Validations"] | Validation rules to be applied before operation <br/> **Default**: `.none` |
| `keepAlive` | [!badge variant="warning" text="UInt64?"] | Keep alive internal in nanosecond, `nil` for disabling <br/> **Default**: 12.5 seconds |

===
Expand Down Expand Up @@ -206,6 +210,7 @@ let server = try Pioneer(
| `websocketProtocol` | [!badge variant="primary" text="WebsocketProtocol"] | Websocket sub-protocol <br/> **Default**: `.subscriptionsTransportws` |
| `introspection` | [!badge variant="primary" text="Bool"] | Allowing introspection <br/> **Default**: `true` |
| `playground` | [!badge variant="primary" text="IDE"] | Allowing playground <br/> **Default**: `.graphiql` |
| `validationRules` | [!badge variant="primary" text="Validations"] | Validation rules to be applied before operation <br/> **Default**: `.none` |
| `keepAlive` | [!badge variant="warning" text="UInt64?"] | Keep alive internal in nanosecond, `nil` for disabling <br/> **Default**: 12.5 seconds |

===
Expand Down
4 changes: 2 additions & 2 deletions Documentation/references/structs.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ Returning the parsed `operationType` of this request.

```swift
let message: GraphQLRequest

switch try message.operationType() {
guard let operationType = message.operationType else { return }
switch operationType {
case .subscription:
// ...
case .query:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Pioneer is an open-source Swift GraphQL server for [Vapor](https://github.com/va
## Setup

```swift
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.8.6")
.package(url: "https://github.com/d-exclaimation/pioneer", from: "0.9.0")
```

## Swift for GraphQL
Expand Down
Binary file modified logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit c273d4b

Please sign in to comment.