Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(apollo-ios-codegen): Stable sort schema types for SchemaMetadata #514

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class IRInputObjectTests: XCTestCase {

func buildSubject() async throws {
let ir: IRBuilder = try await .mock(schema: schemaSDL, document: document)
subject = ir.schema.referencedTypes.inputObjects.first!
subject = ir.schema.referencedTypes.inputObjects[1]
BobaFetters marked this conversation as resolved.
Show resolved Hide resolved
}

// MARK: - Tests
Expand Down
3 changes: 2 additions & 1 deletion apollo-ios-codegen/Sources/IR/IR+Schema.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public final class Schema {
_ types: [GraphQLNamedType],
schemaRootTypes: CompilationResult.RootTypeDefinition
) {
self.allTypes = OrderedSet(types)
// Ensure allTypes is stable
self.allTypes = OrderedSet(types.sorted(by: { $0.name.schemaName < $1.name.schemaName }))
self.schemaRootTypes = schemaRootTypes

var objects = OrderedSet<GraphQLObjectType>()
Expand Down
Loading