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

ArrayIndexConfiguration constructor fix #3342

Merged
merged 1 commit into from
Nov 5, 2024
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
2 changes: 1 addition & 1 deletion Swift/IndexConfiguration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public struct ArrayIndexConfiguration: IndexConfiguration, IndexConfigConvertabl
/// represents an expression defining the values within the array to be indexed.
/// If the array specified by the path contains scalar values, this parameter can be null.
/// - Returns The ArrayIndexConfiguration object.
public init(path: String, _ expressions: [String]? = nil) {
public init(path: String, expressions: [String]? = nil) {
if let expressions = expressions {
if expressions.isEmpty || (expressions.count == 1 && expressions[0].isEmpty) {
NSException(name: .invalidArgumentException,
Expand Down
6 changes: 3 additions & 3 deletions Swift/Tests/UnnestArrayTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ class UnnestArrayTest: CBLTestCase {
/// 2. Check that an invalid arument exception is thrown.
func testArrayIndexConfigInvalidExpressions() throws {
expectException(exception: .invalidArgumentException) {
_ = ArrayIndexConfiguration(path: "contacts", [])
_ = ArrayIndexConfiguration(path: "contacts", expressions: [])
}

expectException(exception: .invalidArgumentException) {
_ = ArrayIndexConfiguration(path: "contacts", [""])
_ = ArrayIndexConfiguration(path: "contacts", expressions: [""])
}
}

Expand Down Expand Up @@ -76,7 +76,7 @@ class UnnestArrayTest: CBLTestCase {
func testCreateArrayIndexWithPathAndExpressions() throws {
let profiles = try db.createCollection(name: "profiles")
try loadJSONResource("profiles_100", collection: profiles)
let config = ArrayIndexConfiguration(path: "contacts", ["address.city", "address.state"])
let config = ArrayIndexConfiguration(path: "contacts",expressions: ["address.city", "address.state"])
try profiles.createIndex(withName: "contacts", config: config)
let indexes = try profiles.indexesInfo()
XCTAssertEqual(indexes!.count, 1)
Expand Down
Loading