github apollographql/apollo-ios 2.6.0

one hour ago

New

  • Add the selectionSetDebugDescriptionConformance codegen option (#1108): Every generated selection set conformed to CustomDebugStringConvertible through ApolloAPI.SelectionSet, which adds a protocol conformance record to your binary for each generated type. For large schemas, these records can increase app launch time. ApolloAPI.SelectionSet no longer inherits CustomDebugStringConvertible. The generated schema-level selection set protocols now declare the conformance instead, controlled by the new option: include (the default, matching previous behavior), exclude, debugOnly, or a custom compilationCondition. debugDescription remains available on every selection set. Without the conformance, String(describing:), debugPrint(_:), and the LLDB po command use the default reflection-based output. Regenerate your code after upgrading to keep the conformance. Thank you to @bdunay3 for the contribution.

Improvement

  • Update the codegen frontend to graphql 17.1.0 (#1110): The bundled GraphQL compiler now uses graphql-js 17.1.0 and is built with rollup 4.68.8 and @rollup/plugin-terser 1.0.2. Generated code is unchanged.

Fixed

  • Generate the same test mocks on every codegen run (#1092): Codegen builds operations and fragments concurrently. When two of them selected different schema fields under the same response key, usually through aliases, the test mock property type depended on which one finished first, so generated mocks could change between runs with no changes to the schema or operations. The property type is now derived from every field selected with that key, so it accepts a value that's valid for every operation selecting it. Fields that differ only in nullability use the nullable type, conflicting object, interface, or union types accept any mock, and other incompatible types use the new AnyFieldValue type in ApolloTestSupport. A field selected through an interface now uses the object's own field type, which can be stricter than the interface's. See Setting properties on test mocks. Thank you to @3redrubies for the contribution.
    • Source changes to generated test mocks: Regenerated mocks can change in two cases. A key selected with conflicting types now has a getter of type Interface or AnyHashable?, list elements that may now be optional, and a parameter that defaults to nil. A field selected through an interface whose object declares a stricter type now uses that type: for example, title: String? = nil becomes title: String = "", and friend: (any AnyMock)? becomes friend: Mock<Dog>?. Update test code that reads these properties or passes values to them.
  • Resolve field policies when the root record is missing from the cache (#1109): A cache read failed before any field policy ran when the store had no QUERY_ROOT record, so a root field missed even when its field policy named a cached record. A missing QUERY_ROOT, MUTATION_ROOT, or SUBSCRIPTION_ROOT record now loads as an empty record, so root fields fall through to their field policies. Any other missing record is still a cache miss. Fixes #3661. Thank you to @drewmclean for the contribution.

Don't miss a new apollo-ios release

NewReleases is sending notifications on new releases.