Releases: apollographql/apollo-ios
1.9.0
Improvement
- New import directive for operations: GraphQL operations now support a directive to control custom module import statements in the generated file. Any operation that includes the directive
@import(module:)
, on the defintion line, with a suppliedString
as the module name will have that module used in a Swiftimport
statement at the top of the operation file and any referenced fragments. Thank you to @hemel for the contribution (#236 / #245).
Fixed
- The
fragmentDefinition
remains in all generated fragments whenoperationDocumentFormat
does not include.definition
(#3282): Code generation will now only generate definitions in fragment files if theoperationDocumentFormat
config contains the.definition
value (#218). Thank you to @jimisaacs for raising the issue. - Custom scalar file header comment (#3323): The header comment for generated custom scalar files was incorrectly changed to state that the output "should not be edited" but the file content could still be edited and would not be overwritten. The header comment has been changed back to state that the contents will be preserved during subsequent codegen executions. Thank you to @matsudamper for raising the issue and the contribution to fix it (#243).
Changed
1.8.0
Fixed
- Duplicate
@defer
directive error (#235): When executing codegen against Apollo Router and a schema that supports the@defer
directive it would fail with an error stating the directive is duplicated.
Changed
- InstallCLI plugin updates (#132): The InstallCLI plugin now downloads the CLI binary from GitHub. This requires that we update the
swift-tools-version
to5.9
, therefore Xcode 15 is now the minimum version of Xcode allowed.
Improvement
- Added
InputObject
casing strategy (#137): We've added a new casing strategy option for InputObjects which mimics the behaviour of the enum case conversion strategy. Thank you to @alexifrim for raising this in issue #3257. - Added
GraphQLResult
conversion extension (#139):GraphQLResult
response data can now be easily converted into a JSON dictionary. This is useful for taking server response data and serializing it into a JSON dictionary which can then be used in a test suite. - Codegen performance improvements (#152): There has been a bunch of refactoring work to prepare for future codegen features but we've also managed to squeeze out some performance improvements.
preview-defer.1
This preview release has been superseded by release 1.14.0.
This is the first preview release of @defer
support in Apollo iOS which focuses on providing early access to using the @defer
directive in your operations. During preview releases bugs can occur, if you do experience anything unexpected please report it to us.
Note: Apollo supports a very specific early RFC version of the @defer
directive as documented here. The @defer
directive is still an RFC and is not an official addition to the GraphQL specification yet. This means that Apollo iOS may not work with all servers that currently support @defer
.
How to use it
We have a sample schema/server that supports @defer
and can be launched using the Docker configuration.
Once you have that service launched you can configure your Apollo iOS client to target the apollo-ios
and apollo-ios-codegen
dependency packages using the preview-defer.1
tag. Below is an example query using @defer
against the schema.
query ExampleQuery {
allProducts {
sku
id
... on Product @defer(label: "additional") {
dimensions {
size
}
variation {
id
name
}
}
}
}
Alternatively here is a sample client to demonstrate the code generation and operation execution of the @defer
directive.
Caveats in this preview release
- Caching is intentionally disabled for operations using
@defer
.
1.7.1
Fixed
- Fixed inconsistent ordering of fragments in generated operation definitions (#130): In order to make the ordering of fragments consistent, they are now alphabetized. This is a change to the data that gets sent over the wire when making a network request for an operation with fragments. Persisted Queries users should re-register their queries when upgrading to this version. Thank you to @scottasoutherland for reporting the issue.
Improvement
- Add initializer for
SelectionSet
that takes a[String: Any]
JSON object (#102): Thank you to @Cookiezby for the contribution.
1.7.0
ApolloCodegenLib
Now Uses Swift Concurrency
To improve the performance of the code generation, the ApolloCodegenLib
now uses async/await
. Code generation is now parallelized and should complete much faster for users with a large number of GraphQL files.
This means that the entry point function, ApolloCodegen.build(with configuration:)
is now an async
function. For users using the ApolloCodegenLib
directly, you will need to make your call sites into this function use async/await
. In most cases, this requires minimal code changes. Please see the 1.7.0 migration guide for information on how to upgrade.
See PR #57.
Fixed
1.6.1
1.6.0
The Apollo iOS ecosystem is changing in the 1.6.0 release in order to provide a better development experience for users. For most users nothing will change, while some users will see a minor difference. The biggest change is that the ApolloCodegenLib
is now in a separate repo/package that will need to be included as its own dependency from apollo-ios-codegen if you are doing your code generation through Swift. If you are using the codegen CLI then no changes are necessary.
For a detailed breakdown of the changes please see this GitHub Issue.
Fixed
- Fixed crashes in iOS 14.4 and below (#61): Thank you to matijakregarGH for reporting the issue.
1.5.2
The purpose of this release is to provide a deprecation message to users of ApolloCodegenLib
who are scripting their code generation in advance of an upcoming change to our libraries and repo structure. Beginning with the upcoming 1.6.0 release the code generation libraries will be their own SPM package in their own repo which will require you to add a new dependency to you project in order for your code generation scripting to compile. More information can be found in our announcement of this change.
If you would like to avoid this deprecation warning in your builds feel free to stay on 1.5.1 or earlier, this warning will be gone in the 1.6.0 release
PR containing deprecation warning for reference: #3243.
1.5.1
Improvement
- Added
OutputOptions
property to codegen for marking generated classes asfinal
(#3189): Thank you to @Mordil for the contribution.
Fixed
- Codegen
itemsToGenerate
option for.all
not generating an operation manifest (#3215): Thank you to @TizianoCoroneo for finding and fixing the issue. - Codegen operation manifest inadvertantly being generated twice (#3225): Thank you to @jimisaacs for finding and fixing the issue.
1.5.0
New
- Added the ability pass a custom
RequestContext
to networking APIs (#3198): Thank you to @danieltiger for the contribution.- Minor Breaking Change: The
requestContext
parameter is optional with a default value ofnil
. This means there are no breaking changes to the APIs for making networking calls. However, therequestContext
parameter was also added to theApolloClientProtocol
. For custom implementations of this protocol (usually used for unit testing), you will need to add therequestContext
parameter to your function signatures.
- Minor Breaking Change: The
Fixed
- Null values are no longer stripped from the underlying data used by generated
SelectionSet
models (apollo-ios-dev/#25):- When these models were manually inserted into the cache, the null fields, which were stripped, were not written to the cache. This caused unintended cache misses when fetching those values back out of the cache.
- This fixes #3092. Thank you to @aleksanderlorenc-lw for raising this issue.