Skip to content

Commit 3d3e597

Browse files
gh-action-runnergh-action-runner
authored andcommitted
Squashed 'apollo-ios/' changes from 4563ad11..d819a576
d819a576 feature: Reduce Generated Schema Types (#601) 81bb93a7 Update ROADMAP.md git-subtree-dir: apollo-ios git-subtree-split: d819a5764124feb5ae4bc1f93b673b6267fa0cac
1 parent 03a9246 commit 3d3e597

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

ROADMAP.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 🔮 Apollo iOS Roadmap
22

3-
**Last updated: 2025-02-11**
3+
**Last updated: 2025-02-18**
44

55
For up to date release notes, refer to the project's [Changelog](https://github.com/apollographql/apollo-ios/blob/main/CHANGELOG.md).
66

@@ -11,6 +11,9 @@ For up to date release notes, refer to the project's [Changelog](https://github.
1111
- Please report feature requests or bugs as a new [issue](https://github.com/apollographql/apollo-ios/issues/new/choose).
1212
- If you already see an issue that interests you please add a 👍 or a comment so we can measure community interest.
1313

14+
### [Currently Requesting Feedback on Caching](https://github.com/apollographql/apollo-ios/issues/3501)
15+
We are currently looking for feedback on what features, use cases, or improvements you would like to see supported by the next iteration of the Apollo iOS normalized cache. Please provide your input on [this issue](https://github.com/apollographql/apollo-ios/issues/3501).
16+
1417
---
1518

1619
## [1.x.x patch releases](https://github.com/apollographql/apollo-ios/milestone/70)
@@ -40,13 +43,6 @@ _Status: In design phase. Current RFC for design is available [here](https://git
4043
-[`ExistentialAny` upcoming feature](https://github.com/apollographql/apollo-ios/issues/3205)
4144
- (in progress) [`Sendable` types and `async/await` APIs](https://github.com/apollographql/apollo-ios/issues/3291)
4245

43-
### [Reduce generated schema types](https://github.com/apollographql/apollo-ios/milestone/71)
44-
45-
_Status: API Design in progress_
46-
47-
- Right now we are naively generating schema types that we don't always need. A smarter algorithm can reduce generated code for certain large schemas that are currently having every type in their schema generated
48-
- Create configuration for manually indicating schema types you would like to have schema types and TestMocks generated for
49-
5046
### [Support codegen of operations without response models](https://github.com/apollographql/apollo-ios/issues/3165)
5147

5248
_Status: API Design in progress_
@@ -86,6 +82,8 @@ These are the initiatives planned for future major version releases:
8682

8783
## Caching
8884

85+
[**Requesting Feedback**](https://github.com/apollographql/apollo-ios/issues/3501): We are currently looking for feedback on what features, use cases, or improvements you would like to see supported by the next iteration of the Apollo iOS normalized cache. Please provide your input on [this issue](https://github.com/apollographql/apollo-ios/issues/3501).
86+
8987
- **Cache Improvements**: Here we are looking at bringing across some features inspired by Apollo Client 3 and Apollo Kotlin
9088
- Better pagination support. Better support for caching and updating paginated lists of objects.
9189
- Result model improvements

Sources/ApolloAPI/SchemaTypes/Interface.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,24 @@ public struct Interface: Hashable, Sendable {
1212
///
1313
/// This is set by adding a `@typePolicy` directive to the schema.
1414
public let keyFields: [String]?
15+
16+
/// A list of name for Objects that implement this Interface
17+
public let implementingObjects: [String]
1518

1619
/// Designated Initializer
1720
///
1821
/// - Parameter name: The name of the ``Interface`` in the GraphQL schema.
19-
public init(name: String, keyFields: [String]? = nil) {
22+
public init(
23+
name: String,
24+
keyFields: [String]? = nil,
25+
implementingObjects: [String]
26+
) {
2027
self.name = name
2128
if keyFields?.isEmpty == false {
2229
self.keyFields = keyFields
2330
} else {
2431
self.keyFields = nil
2532
}
33+
self.implementingObjects = implementingObjects
2634
}
2735
}

Sources/ApolloAPI/SchemaTypes/Object.swift

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,21 @@ public struct Object: Hashable, Sendable {
1717
keyFields: [String]? = nil
1818
) {
1919
self.typename = typename
20-
self.implementedInterfaces = implementedInterfaces
20+
self._implementedInterfaces = implementedInterfaces
2121
if keyFields?.isEmpty == false {
2222
self.keyFields = keyFields
2323
} else {
2424
self.keyFields = nil
2525
}
2626
}
2727

28+
private let _implementedInterfaces: [Interface]
29+
2830
/// A list of the interfaces implemented by the type.
29-
public let implementedInterfaces: [Interface]
31+
@available(*, deprecated, message: "This property will be removed in version 2.0. To check if an Object implements an interface please use the 'implements(_)' function.")
32+
public var implementedInterfaces: [Interface] {
33+
return _implementedInterfaces
34+
}
3035

3136
/// The name of the type.
3237
///
@@ -44,6 +49,6 @@ public struct Object: Hashable, Sendable {
4449
/// - Parameter interface: An ``Interface`` Type
4550
/// - Returns: A `Bool` indicating if the receiver implements the given ``Interface`` Type.
4651
public func implements(_ interface: Interface) -> Bool {
47-
implementedInterfaces.contains(where: { $0 == interface })
52+
interface.implementingObjects.contains(typename)
4853
}
4954
}

0 commit comments

Comments
 (0)