Skip to content

Commit

Permalink
Release - 0.49.0 (#1940)
Browse files Browse the repository at this point in the history
* Bump version number
* Update documentation for Swift-based schema download
* Update CHANGELOG for Swift-based schema download
* Update SwiftScripting documentation
* Update CHANGELOG.md
  • Loading branch information
calvincestari authored Sep 21, 2021
1 parent 6672b0e commit d328c0e
Show file tree
Hide file tree
Showing 14 changed files with 153 additions and 89 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change log

## v0.49.0
- **Breaking - Schema download is now Swift-based:** The dependency on the Apollo CLI (Typescript-based) for schema downloading has been removed. Schema downloading is now Swift-based, outputs GraphQL SDL (Schema Definition Language) by default, and is maintainable/extensible within apollo-ios with full [API documentation](https://www.apollographql.com/docs/ios/api/ApolloCodegenLib/structs/ApolloSchemaDownloader/). This is a breaking change because some of the API signatures have changed. [Swift scripting](https://www.apollographql.com/docs/ios/swift-scripting/) offers a convenient way to perform certain operations that would otherwise require the command line - it's worth a look if you haven't tried it yet. [#1935](https://github.com/apollographql/apollo-ios/pull/1935)

## v0.48.0
- **Customizable subscription message identifiers:** The `WebSocketTransport` initializer can be configured with a subclass of `OperationMessageIdCreator` to provide a unique identifier per request. The default implementation is `ApolloSequencedOperationMessageIdCreator` and retains the current behavior of sequential message numbering. [#1919](https://github.com/apollographql/apollo-ios/pull/1919) - _Thank you to [Clark McNally](https://github.com/cmcnally-beachbody) for the contribution!_
- **AWS AppSync Compatibility:** Apollo-ios will now correctly handle the `start_ack` message that AWS AppSync servers respond with when a subscription is requested. [#1919](https://github.com/apollographql/apollo-ios/pull/1919) - _Thank you to [Clark McNally](https://github.com/cmcnally-beachbody) for the contribution!_
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Shared/Project-Version.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 0.48.0
CURRENT_PROJECT_VERSION = 0.49.0
11 changes: 6 additions & 5 deletions docs/source/api/ApolloCodegenLib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@

- [ApolloCLI](structs/ApolloCLI/)
- [ApolloCodegenOptions](structs/ApolloCodegenOptions/)
- [ApolloSchemaDownloadConfiguration](structs/ApolloSchemaDownloadConfiguration/)
- [ApolloSchemaDownloadConfiguration.HTTPHeader](structs/ApolloSchemaDownloadConfiguration.HTTPHeader/)
- [ApolloSchemaDownloader](structs/ApolloSchemaDownloader/)
- [ApolloSchemaOptions](structs/ApolloSchemaOptions/)
- [Basher](structs/Basher/)
- [CodegenLogger](structs/CodegenLogger/)
- [DownloadMethod.RegistrySettings](structs/DownloadMethod.RegistrySettings/)
- [DownloadMethod.ApolloRegistrySettings](structs/DownloadMethod.ApolloRegistrySettings/)
- [FileFinder](structs/FileFinder/)
- [GraphQLSourceLocation](structs/GraphQLSourceLocation/)

Expand Down Expand Up @@ -53,8 +54,8 @@
- [ApolloCodegenOptions.CodeGenerationEngine](enums/ApolloCodegenOptions.CodeGenerationEngine/)
- [ApolloCodegenOptions.CustomScalarFormat](enums/ApolloCodegenOptions.CustomScalarFormat/)
- [ApolloCodegenOptions.OutputFormat](enums/ApolloCodegenOptions.OutputFormat/)
- [ApolloSchemaOptions.DownloadMethod](enums/ApolloSchemaOptions.DownloadMethod/)
- [ApolloSchemaOptions.SchemaFileType](enums/ApolloSchemaOptions.SchemaFileType/)
- [ApolloSchemaDownloadConfiguration.DownloadMethod](enums/ApolloSchemaDownloadConfiguration.DownloadMethod/)
- [ApolloSchemaDownloader.SchemaDownloadError](enums/ApolloSchemaDownloader.SchemaDownloadError/)
- [ApolloURLError](enums/ApolloURLError/)
- [Basher.BashError](enums/Basher.BashError/)
- [CodegenLogger.LogLevel](enums/CodegenLogger.LogLevel/)
Expand All @@ -66,7 +67,7 @@

- [ApolloCodegenOptions](extensions/ApolloCodegenOptions/)
- [ApolloExtension](extensions/ApolloExtension/)
- [ApolloSchemaOptions](extensions/ApolloSchemaOptions/)
- [ApolloSchemaDownloadConfiguration](extensions/ApolloSchemaDownloadConfiguration/)
- [FileHandle](extensions/FileHandle/)
- [GraphQLType](extensions/GraphQLType/)
- [JavaScriptError](extensions/JavaScriptError/)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,14 @@ public func loadSchemaFromSDL(_ source: GraphQLSource) throws -> GraphQLSchema

Load a schema by parsing SDL.

### `printSchemaAsSDL(schema:)`

```swift
public func printSchemaAsSDL(schema: GraphQLSchema) throws -> String
```

Take a loaded GQL schema and print it as SDL.

### `makeSource(_:filePath:)`

```swift
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
**ENUM**

# `ApolloSchemaOptions.DownloadMethod`
# `ApolloSchemaDownloadConfiguration.DownloadMethod`

```swift
public enum DownloadMethod: Equatable
Expand All @@ -9,19 +9,21 @@ public enum DownloadMethod: Equatable
How to attempt to download your schema

## Cases
### `registry(_:)`
### `apolloRegistry(_:)`

```swift
case registry(_ settings: RegistrySettings)
case apolloRegistry(_ settings: ApolloRegistrySettings)
```

The Apollo Schema Registry, which serves as a central hub for managing your data graph.

### `introspection(endpointURL:)`

```swift
case introspection(endpointURL: URL)
```

- endpointURL: The endpoint to hit to download your schema.
GraphQL Introspection connecting to the specified URL.

## Methods
### `==(_:_:)`
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
**ENUM**

# `ApolloSchemaDownloader.SchemaDownloadError`

```swift
public enum SchemaDownloadError: Error, LocalizedError
```

## Cases
### `downloadedRegistryJSONFileNotFound(underlying:)`

```swift
case downloadedRegistryJSONFileNotFound(underlying: Error)
```

### `downloadedIntrospectionJSONFileNotFound(underlying:)`

```swift
case downloadedIntrospectionJSONFileNotFound(underlying: Error)
```

### `couldNotParseRegistryJSON(underlying:)`

```swift
case couldNotParseRegistryJSON(underlying: Error)
```

### `unexpectedRegistryJSONType`

```swift
case unexpectedRegistryJSONType
```

### `couldNotExtractSDLFromRegistryJSON`

```swift
case couldNotExtractSDLFromRegistryJSON
```

### `couldNotCreateSDLDataToWrite(schema:)`

```swift
case couldNotCreateSDLDataToWrite(schema: String)
```

### `couldNotConvertIntrospectionJSONToSDL(underlying:)`

```swift
case couldNotConvertIntrospectionJSONToSDL(underlying: Error)
```

## Properties
### `errorDescription`

```swift
public var errorDescription: String?
```

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
**EXTENSION**

# `ApolloSchemaOptions`
# `ApolloSchemaDownloadConfiguration`
```swift
extension ApolloSchemaOptions: CustomDebugStringConvertible
extension ApolloSchemaDownloadConfiguration: CustomDebugStringConvertible
```

## Properties
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
**STRUCT**

# `ApolloSchemaDownloadConfiguration.HTTPHeader`

```swift
public struct HTTPHeader: Equatable, CustomDebugStringConvertible
```

## Properties
### `debugDescription`

```swift
public var debugDescription: String
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
**STRUCT**

# `ApolloSchemaDownloadConfiguration`

```swift
public struct ApolloSchemaDownloadConfiguration
```

A configuration object that defines behavior for schema download.

## Methods
### `init(using:timeout:headers:outputFolderURL:schemaFilename:)`

```swift
public init(using downloadMethod: DownloadMethod,
timeout downloadTimeout: Double = 30.0,
headers: [HTTPHeader] = [],
outputFolderURL: URL,
schemaFilename: String = "schema")
```

Designated Initializer

- Parameters:
- downloadMethod: How to download your schema.
- downloadTimeout: The maximum time to wait before indicating that the download timed out, in seconds. Defaults to 30 seconds.
- headers: [optional] Any additional headers to include when retrieving your schema. Defaults to nil
- outputFolderURL: The URL of the folder in which the downloaded schema should be written
- schemaFilename: The name, without an extension, for your schema file. Defaults to `"schema"

#### Parameters

| Name | Description |
| ---- | ----------- |
| downloadMethod | How to download your schema. |
| downloadTimeout | The maximum time to wait before indicating that the download timed out, in seconds. Defaults to 30 seconds. |
| headers | [optional] Any additional headers to include when retrieving your schema. Defaults to nil |
| outputFolderURL | The URL of the folder in which the downloaded schema should be written |
| schemaFilename | The name, without an extension, for your schema file. Defaults to `“schema” |
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,20 @@ public struct ApolloSchemaDownloader
A wrapper to facilitate downloading a schema with the Apollo node CLI

## Methods
### `run(with:options:)`
### `fetch(with:)`

```swift
public static func run(with cliFolderURL: URL,
options: ApolloSchemaOptions) throws -> String
public static func fetch(with configuration: ApolloSchemaDownloadConfiguration) throws
```

Runs code generation from the given folder with the passed-in options
Downloads your schema using the specified configuration object.

- Parameters:
- cliFolderURL: The folder where the Apollo CLI is/should be downloaded.
- options: The `ApolloSchemaOptions` object to use to download the schema.
- configuration: The `ApolloSchemaDownloadConfiguration` object to use to download the schema.
- Returns: Output from a successful run

#### Parameters

| Name | Description |
| ---- | ----------- |
| cliFolderURL | The folder where the Apollo CLI is/should be downloaded. |
| options | The `ApolloSchemaOptions` object to use to download the schema. |
| configuration | The `ApolloSchemaDownloadConfiguration` object to use to download the schema. |
41 changes: 0 additions & 41 deletions docs/source/api/ApolloCodegenLib/structs/ApolloSchemaOptions.md

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
**STRUCT**

# `DownloadMethod.RegistrySettings`
# `DownloadMethod.ApolloRegistrySettings`

```swift
public struct RegistrySettings: Equatable
public struct ApolloRegistrySettings: Equatable
```

## Properties
Expand All @@ -13,38 +13,44 @@ public struct RegistrySettings: Equatable
public let apiKey: String
```

The API key to use when retrieving your schema from the Apollo Registry.

### `graphID`

```swift
public let graphID: String
```

The identifier of the graph to fetch. Can be found in Apollo Studio.

### `variant`

```swift
public let variant: String?
```

The variant of the graph in the registry.

## Methods
### `init(apiKey:graphID:variant:)`

```swift
public init(apiKey: String,
graphID: String,
variant: String? = nil)
variant: String = "current")
```

Designated initializer

- Parameters:
- apiKey: The API key to use when retrieving your schema.
- graphID: The identifier of the graph to fetch. Can be found in Apollo Studio.
- variant: [Optional] The variant of the graph to fetch. Defaults to nil, which will return whatever is set to the current variant.
- variant: The variant of the graph to fetch. Defaults to "current", which will return whatever is set to the current variant.

#### Parameters

| Name | Description |
| ---- | ----------- |
| apiKey | The API key to use when retrieving your schema. |
| graphID | The identifier of the graph to fetch. Can be found in Apollo Studio. |
| variant | [Optional] The variant of the graph to fetch. Defaults to nil, which will return whatever is set to the current variant. |
| variant | The variant of the graph to fetch. Defaults to “current”, which will return whatever is set to the current variant. |
2 changes: 1 addition & 1 deletion docs/source/swift-scripting.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ This command will download a GraphQL schema. There are two pieces you definitely
- The place you want to download your schema from. This is usually via introspection of your GraphQL endpoint, so the default is set to use this, you just need to replace the `localhost` URL with the URL of your GraphQL endpoint. If you've got it set up, you can also download your schema from the Apollo Schema Registry. You'll need to add your API Key and Graph ID for this, which you can get from Apollo Studio.
- The name of the folder where you want the schema downloaded. If you've followed the template above, you'll want to place the schema in the folder where your target's code lives.

You can also use [options provided by the `ApolloSchemaOptions` object](https://www.apollographql.com/docs/ios/api/ApolloCodegenLib/structs/ApolloSchemaOptions/) to further configure how and where you want to download your schema.
You can also use [options provided by the `ApolloSchemaDownloadConfiguration` object](https://www.apollographql.com/docs/ios/api/ApolloCodegenLib/structs/ApolloSchemaDownloadConfiguration/) to further configure how and where you want to download your schema.

#### GenerateCode

Expand Down

0 comments on commit d328c0e

Please sign in to comment.