apple / swift-cassandra-client

Cassandra client in Swift
https://swiftpackageindex.com/apple/swift-cassandra-client/main/documentation/cassandraclient
Apache License 2.0
94 stars 21 forks source link

VerifyFlag.none is ambiguous as an optional #13

Closed mattmassicotte closed 1 year ago

mattmassicotte commented 1 year ago

The following code produces a warning:

var ssl = CassandraClient.Configuration.SSL()
ssl.verifyFlag = .none
Assuming you mean 'Optional<CassandraClient.Configuration.SSL.VerifyFlag>.none'; did you mean 'CassandraClient.Configuration.SSL.VerifyFlag.none' instead?

This is because verifyFlag is optional. Given that it is an enum, I'm going to guess that nil is equivalent to none anyways. What do you think about making this field non-optional?

yim-lee commented 1 year ago

Actually, ssl.verifyFlag = nil means cass_ssl_set_verify_flags doesn't get called, so the DataStax driver will use the default, which is CASS_SSL_VERIFY_PEER_CERT.

+1 on making verifyFlag non-optional. I am adding .default case to the enum. See https://github.com/apple/swift-cassandra-client/pull/15

mattmassicotte commented 1 year ago

Fantastic!