Description
OpenAPIObjectContainer’s hash(into:) depends on dictionary iteration order. This can cause equal values to produce different hashes.
Reproduction
func testHashing_objectOrderIndependence_success() throws {
let container1 = try OpenAPIObjectContainer(
unvalidatedValue: ["foo": 0, "bar": 1]
)
let container2 = try OpenAPIObjectContainer(
unvalidatedValue: ["bar": 1, "foo": 0]
)
XCTAssertEqual(container1, container2)
XCTAssertEqual(container1.hashValue, container2.hashValue)
}
Package version(s)
├── swift-openapi-generator<https://github.com/apple/swift-openapi-generator@1.13.0>(traits: default)
│ ├── swift-algorithms<https://github.com/apple/swift-algorithms@1.2.1>(traits: default)
│ │ └── swift-numerics<https://github.com/apple/swift-numerics.git@1.0.3>(traits: default)
│ ├── openapikit<https://github.com/mattpolzin/OpenAPIKit@6.2.0>
│ ├── yams<https://github.com/jpsim/Yams@6.0.1>(traits: default)
│ └── swift-argument-parser<https://github.com/apple/swift-argument-parser@1.5.1>(traits: default)
├── swift-openapi-runtime<https://github.com/apple/swift-openapi-runtime@1.12.0>(traits: FullFoundation)
│ └── swift-http-types<https://github.com/apple/swift-http-types@1.4.0>(traits: default)
└── swift-openapi-urlsession<https://github.com/apple/swift-openapi-urlsession@1.3.1>(traits: default)
├── swift-openapi-runtime<https://github.com/apple/swift-openapi-runtime@1.12.0>(traits: FullFoundation)
│ └── swift-http-types<https://github.com/apple/swift-http-types@1.4.0>(traits: default)
├── swift-http-types<https://github.com/apple/swift-http-types@1.4.0>(traits: default)
└── swift-collections<https://github.com/apple/swift-collections@1.2.0>(traits: default)
Expected behavior
OpenAPIObjectContainer’s hash should return same value for equal containers.
Environment
swift-driver version: 1.148.6 Apple Swift version 6.3.3 (swiftlang-6.3.3.1.3 clang-2100.1.1.101)
Target: arm64-apple-macosx26.0
Additional information
No response
Description
OpenAPIObjectContainer’s hash(into:) depends on dictionary iteration order. This can cause equal values to produce different hashes.
Reproduction
Package version(s)
Expected behavior
OpenAPIObjectContainer’s hash should return same value for equal containers.
Environment
Additional information
No response