APQConfig & operationIdentifiersPath in ApolloCodegenConfiguration.
OperationDocumentFormat and OperationManifestFileOutput respectively. Please see the documentation for ApolloCodegenConfiguration for more information.Though 1.3.0 is a minor version bump, some critical issues were addressed in this version that requires a small breaking change during the upgrade. While we strive to make the upgrade path for minor versions seamless, these issues could not be reasonably resolved without requiring this migration.
For a detailed explanation of the breaking changes and a guide on how to migrate to 1.3.0, see our migration guide.
nil incorrectly. See PR #3067. Thank you to @tgyhlsb and @dafurman for raising these issues.Though 1.2 is a minor version bump, a critical problem was addressed in this version that requires a small breaking change during the upgrade. While we strive to make the upgrade path for minor versions seamless, this issue could not be reasonably resolved without requiring this migration.
For most users, this migration will only require a single change to your SchemaConfiguration.swift file.
For a detailed explanation of the breaking changes and a guide on how to migrate to v1.2, see our migration guide.
cacheKeyInfo(for:object:) function, defined in your generated SchemaConfiguration.swift file, has been modified. For more information, see our migration guide.GraphQLExecutor resulted in a ~15-20% reduction in execution time for parsing and mapping network response or cache data onto generated models.DataDict used to store the data for generated models has been updated to use copy-on-write value semantics. This resulted in a ~70-80% reduction in the execution time of initialization and type case conversions in the generated models..relative(subpath:) operations (#2969): See PR #2994. Thank you to @jimisaacs for raising the issue.__fulfilled (#2944): See PR #2990. Thank you to @scottasoutherland for raising the issue.internal access modifier (#2630): See PR #2917. Thank you to @simonbilskyrollins for the feature request.@dynamicMember conflicting field name (#2950): The subscript setters have been changed to allow a selection set property named hash. #2965 Thank you to @renanbdias for raising the issue.apollo is no longer allowed as a target name otherwise it causes a conflict when importing Apollo as a module. #2972 Thank you to @moopoints for raising the issue.__typename fix (#2955): Custom root types defined in the schema are now correctly applied to selection set fields typename definitions #2983 Thank you to @ynnadrules for raising the issue.cancel() on Cancellable (#2932): Calling cancel() on a non-subscription Cancellable will now correctly handle the lifetime of the internally Unmanaged object. #2943 - Thank you to @yonaskolb for raising the issue.Upload operations can now have custom error interceptors like other operations. #2948 Thank you to @RobertDresler for the contribution.Apollo iOS v1.1 primarily focuses on adding generated initializers to the generated operation models.
In most cases, the upgrade from v1.0 to v1.1 should require no changes to your code.
@include/@skip directive that has a different parent type than the selection set it is being spread into, the shape of the generated models has changed.
... on DetailNode @include(if: $includeDetails) would have previously been named asDetailNode; it will now be generated as asDetailNodeIfIncludeDetails.public but intended for internal usage only have been changed.
SelectionSet models now keep track of which fragments were fulfilled during GraphQL execution in order to enable conversions between type cases. While this does not cause functional changes while using public APIs, this is a fundamental change to the way that the underlying data for a SelectionSet is formatted, it is now required that all SelectionSet creation must be processed by the GraphQLExecutor or a generated initializer that is guaranteed to correctly format the data. This means that initializing a SelectionSet using raw JSON data directly will no longer work. Please ensure that raw JSON data is only used with the new RootSelectionSet.init(data: variables) initializer.null or nil values to the cache was causing crashes in 1.1 Beta 1. This is now fixed.selectionSetInitializers option on your code generation configuration. Manually initialized selection sets can be used for a number of purposes, including:
SelectionSet models with raw JSON: In 1.0, initializing SelectionSet models with raw JSON was unsafe and required usage of underscore prefixed APIs that were intended for internal usage only. Apollo iOS 1.1 introduces a new, safe initializer: RootSelectionSet.init(data: variables).
SelectionSet models. If the provided data is invalid, this initializer throws an error, ensuring that your model usage is always safe.__typename selection for generated models: In 1.1, the code generator adds the __typename field to each root object. In previous versions, this selection was automatically inferred by the GraphQLExecutor, however generating it directly should improve performance of GraphQL execution.This is the first Beta Release of Apollo iOS 1.1. Version 1.1 primarily focuses on adding generated initializers to the generated operation models.
While no breaking changes were made to official public APIs, some underscore prefixed APIs that are public but intended for internal usage only have been changed.
selectionSetInitializers option on your code generation configuration. Manually initialized selection sets can be used for a number of purposes, including:
SelectionSet models with raw JSON: In 1.0, initializing SelectionSet models with raw JSON was unsafe and required usage of underscore prefixed APIs that were intended for internal usage only. Apollo iOS 1.1 introduces a new, safe initializer: RootSelectionSet.init(data: variables).
SelectionSet models. If the provided data is invalid, this initializer throws an error, ensuring that your model usage is always safe.SelectionSet models now keep track of which fragments were fulfilled during GraphQL execution in order to enable conversions between type cases. While this does not cause functional changes while using public APIs, this is a fundamental change to the way that the underlying data for a SelectionSet is formatted, it is now required that all SelectionSet creation must be processed by the GraphQLExecutor or a generated initializer that is guaranteed to correctly format the data. This means that initializing a SelectionSet using raw JSON data directly will no longer work. Please ensure that raw JSON data is only used with the new RootSelectionSet.init(data: variables) initializer.__typename selection for generated models: In 1.1, the code generator adds the __typename field to each root object. In previous versions, this selection was automatically inferred by the GraphQLExecutor, however generating it directly should improve performance of GraphQL execution.@include/@skip directive that has a different parent type than the selection set it is being spread into, the shape of the generated models has changed. This does not affect generated call sites, but only affects the generated selection metadata used internally by the GraphQLExecutor.for has been added to the list of reserved keywords that are escaped with backticks when used in schema types and operations. #2772 - Thank you to @torycons for raising the issue._ character can be used as a GraphQL field name. #2769 - Thank you to @neakor for raising the issue._jsonValue. #2778 - Thank you to @dabby-wombo for raising the issue.AnyHashable conversions when accessing DataDict properties now perform checks on the base type. #2784 - Thank you to @bdunay3 for raising the issue.@include directive based on variable with default value drops the included data (#2690): The GraphQL executor will now correctly evaluate GraphQLNullable conditional variables. #2794 - Thank you to @klanchman for raising the issue.HTTPHeaders in the ApolloSchemaDownloadConfiguration section of the codegen configuration JSON file can now be specified using the more intuitive format { "Authorization": "<token>"}. #2811 - Thank you to @nikitrivedii for raising the issue.graphQLSchema in scope (#2705): Generated fragments now use the correct schema namespace casing. #2730 - Thank you to @iAmericanBoy for raising the issue.ApolloAPI.JSONDecodingError.missingValue error (#2697): Cache mutations will now allow incomplete data to be written to the cache without expecting all fields to be set. Please note that cache manipulation is an advanced feature and you should be aware of how the data written will affect network requests and cache policies. #2751 - Thank you to @amseddi for raising the issue.GraphQLEnum value camel case conversion strategy (#2640), (#2749): The camel case conversion logic for GraphQL enums has been improved to handle a wider range of edge cases that were causing invalid Swift code generation. #2745 - Thank you to @ddanielczyk and @hispanico94 for raising the issues.Selection type from apollo (#2708): ParentType and Selection types in generated selection sets now use a fully qualified namespace to prevent typename conflicts. #2754 - Thank you to @tahirmt for raising the issue.schemaName (#2664): Certain strings are now disallowed for use as the schema namespace. #2755 - Thank you to @StarLard for raising the issue.DocumentType in generated mock code (#2719): All shared referenced schema types within test mocks now use a fully qualified named type. #2762 - Thank you to @dafurman for raising the issue.Install CLI plug-in is now available from the SPM command line and the Xcode project menu. #2683DocumentType namespacing: The correct module namespacing is now used for DocumentType in generated operation code. #2679init, fetch-schema, and generate have been removed. There is a new plug-in to install the CLI and the CLI commands should be used from the command line instead. #2649.inSchemaModule, and the init command now requires a module type to be specified when creating a configuration file. #2673data dictionary in the InputDict struct if the name of the accessed property is hash: Dyanamic Member Lookup has been removed from InputDict to prevent potential name clashes. #2607@inlinable has been removed from parts of ApolloAPI that were preventing xcframework builds with the BUILD_LIBRARY_FOR_DISTRIBUTION build setting. #2613Variables type in local cache mutations is not properly namespaced: The Variables type in LocalCacheMutation now has the required prefix of GraphQLOperation to build successfully. #2615.build/.swiftpm/.Pods folders: If code generation was executed from a path where subfolders contained the apollo-ios repo, it would find internal test schemas and fail. These special folders are now ignored. #2628GraphQLEnum property will cause a crash: JSON Encoding the mocks into the SelectionSet.DataDict was causing CustomScalar values to get encoded into their JSON values. The mock data is now converted into the correct format for the SelectionSet.DataDict. #2584 Thank you to @asapo for reporting the issue.DocumentType enum is now correctly namespaced in generated code. #2585 Thank you to @matijakregarGH for reporting the issue.GraphQLNullable nil coalescing: @exported import statements now ensure that the operator overload is imported when using the generated models. #2600 Thank you to bassrock for reporting the issue.generate command of apollo-ios-cli would result in a fatal error. #2548 Thank you to @ilockett for reporting the issue.XcodePluginContext from Xcode 14 and accepts the additional command line options that Xcode sends. #2554 Thank you to @SilverTab for reporting the issue.@available attribute. They will now have comments indicating their deprecated status. #2579This is the first major version release of Apollo iOS! The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
In a nutshell, v1.0.0 brings:
There is documentation and a blog post coming soon. Feel free to ask questions by either opening an issue on our GitHub repo, or joining the community.
Thank you to all contributors who have helped us get to this first major release! ❤️
This is the first Release Candidate for Apollo iOS 1.0. The Release Candidate is a fully featured and code-complete representation of the final 1.0 version. This includes full feature parity with the 0.x.x releases.
API breaking changes are not expected between the Release Candidate and the General Availability (GA) release. The only code changes will be non-breaking bug fixes due to user feedback. The Release Candidate does not have complete documentation or usage guides, which will be completed prior to GA.
This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
apollo-codegen-config.json file used by the Apollo CLI needed to contain values for all optional fields. When new codegen options were added, this would cause errors until all newly added options has values provided.Codable implementation for the ApolloCodgenConfiguration has been implemented manually to prevent this. Now, only required fields must be provided, all optional fields can be omitted from the config file safely.init command also now generates a template config file with only the required fields.@skip and @include conditions on the same field--allow-writing-to-package-directory flag when executing the plugin command..persistedOperationsOnly
.persistedOperationsOnly is for use with allow-listed operations only. If an operation identifier is not recognized by the server, there is no way to register the operation in this configuration.ApolloAPI internal metadata properties to be __ prefixed.
Apollo library during GraphQL Execution. These members must be public in order to be exposed to Apollo, but are not intended for external consumption. We have added underscore prefixes to each of these members to signify that intention, using __ for GraphQL Metadata (in alignment with the GraphQL Specification) and _ for Apollo's utility and helper functions.SelectionSet.schema -> SelectionSet.__schemaSelectionSet.selection -> SelectionSet.__selectionJSONEncodable.jsonValue -> JSONEncodable._jsonValueJSONDecodable.init(jsonValue:) -> JSONDecodable.init(_jsonValue:)AnyHashableConvertible.asAnyHashable -> AnyHashableConvertible._asAnyHashableOutputTypeConvertible.asOutputType -> OutputTypeConvertible._asOutputTypeGraphQLOperation.variables -> GraphQLOperation._variablesLocalCacheMutation.variables -> LocalCacheMutation._variablesThis is the fourth Beta Release of Apollo iOS 1.0. The Beta version has full feature parity with the 0.x.x releases. The API is expected to be mostly stable. Some breaking changes may occur due to user feedback prior to General Availability (GA) Release. The Beta does not have complete documentation or usage guides, which will be completed prior to GA.
This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
.graphql.swift.
.swift file extension.
CustomScalar templates as well as the SchemaConfiguration file are user-editable. Once these are generated, they are never overwritten by future code generation execution..graphql file is removed from your project. The generated file will also be deleted the next time code generation is run.pruneGeneratedFiles codegen option..graphql.swift file extension will be deleted.conversionStrategies.enumCases codegen option.ReadTransaction Thanks @lorraine-hatch for the fix!jsonValue Initializer for Large Numbers Thanks @Almaz5200 for the fix!