Skip to content

Commit

Permalink
feat(apollo-ios-codegen): Stable sort schema types for SchemaMetadata (
Browse files Browse the repository at this point in the history
  • Loading branch information
asmundg authored and gh-action-runner committed Oct 21, 2024
1 parent 134147b commit d336f36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
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]
}

// 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

0 comments on commit d336f36

Please sign in to comment.