vapor/vapor

Stored property '_id' of 'Sendable'-conforming class 'Todo' is mutable

crawford-jake opened this issue · 3 comments

Describe the issue

A warning is appearing on all classes that conform to Model

Vapor version

4.94.1

Operating system and version

macOS 14.4.1

Swift version

Swift 5.10.0-dev

Steps to reproduce

  1. Create a new vapor project: vapor new my-app
  2. Enter the following prompts:
  • Would you like to use Fluent (ORM)? (--fluent/--no-fluent): y
  • Which database would you like to use? (--fluent.db): 1
  • Would you like to use Leaf (templating)? (--leaf/--no-leaf): n
  1. Open the vapor project in Xcode using Xcode 15.3
  2. Navigate to Sources > App > Models > Todo
  3. Warning: Stored property '_id' of 'Sendable'-conforming class 'Todo' is mutable
Screenshot 2024-04-29 at 5 41 18 PM

Outcome

This warning appears on any class that conforms to Model.

Additional notes

Running on M2 mac

This is unfortunately an expected side effect of making Fluent otherwise Sendable-correct. I've been in touch with the Swift Core team about it; they were able to offer no better solution than to annotate each individual Model-conforming type with @unchecked Sendable 🙁. We'll be publishing a blog post with more details sometime this week.

That being said, I did forget to update the template project accordingly 😰 Thanks for the nudge!

Should this be mentioned in the documentation as well, I got confused when this error occurred during new model creation.

We'll be publishing a blog post with more details sometime this week.

And maybe, once it's there, also reference the blogpost, at least in this issue I'd say