#Strict Concurrency Checking: FieldKey is not sendable

1 messages · Page 1 of 1 (latest)

boreal nexus
#

In the following snippet:

struct MySchema {
    enum Field {
        static let createdAt: FieldKey = "created_at"
        static let updatedAt: FieldKey = "updated_at"
    }
}

I get the following warning:

Static property 'createdAt' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6
Static property 'updatedAt' is not concurrency-safe because it is not either conforming to 'Sendable' or isolated to a global actor; this is an error in Swift 6

I tried to add the following:

extension FieldKey: Sendable { }

But I get:

Conformance to 'Sendable' must occur in the same source file as enum 'FieldKey'; use '@unchecked Sendable' for retroactive conformance

Perhaps it's as easy as adding it to FluentKit's FieldKey file?

jovial oar
#

FieldKey can be Sendable, you can do a PR if you'd like?

shut lion
#

FieldKey is part of Fluent, same as models 🙂

jovial oar
#

Yeah but it's just an enum that we can mark Sendable to remove the warnings from above. Anyone following the pattern of defining field keys to remove all the strings will be seeing the warnings so we could do a patch release just for field keys