Using @ID(key:) with a key other than .id or a value that is not a UUID is now a compile-time error instead of a runtime crash.
Additional changes:
The legacy @ID(key: "id") syntax, where the key is specified as a string rather than using the .id enumeration case, is hard-deprecated. Replace such usages with @ID(key: .id). This deprecation does not apply to custom IDs.
The @ID(key: .id) syntax is now considered soft-deprecated. @ID is now the recommend usage.
Minor CI improvements
⚠️ IMPORTANT ⚠️
Incorrect usage of @ID(key: "...") with any string other than "id" will still trigger a fatal error at runtime as well as the deprecation warning. This is unavoidable without a source-breaking change, since the contents of the string can not be checked at compile time.
Incorrect usage of @ID where the type of the property is not UUID - for example, @ID var id: Int? - usually results in the extremely unhelpful compiler error "Type of expression is ambiguous without more context." Unfortunately, there doesn't seem to be a way to make this less opaque at the moment.
Using
@ID(key:)
with a key other than.id
or a value that is not aUUID
is now a compile-time error instead of a runtime crash.Additional changes:
@ID(key: "id")
syntax, where the key is specified as a string rather than using the.id
enumeration case, is hard-deprecated. Replace such usages with@ID(key: .id)
. This deprecation does not apply to custom IDs.@ID(key: .id)
syntax is now considered soft-deprecated.@ID
is now the recommend usage.⚠️ IMPORTANT ⚠️
@ID(key: "...")
with any string other than"id"
will still trigger a fatal error at runtime as well as the deprecation warning. This is unavoidable without a source-breaking change, since the contents of the string can not be checked at compile time.@ID
where the type of the property is notUUID
- for example,@ID var id: Int?
- usually results in the extremely unhelpful compiler error "Type of expression is ambiguous without more context.
" Unfortunately, there doesn't seem to be a way to make this less opaque at the moment.