vapor / fluent

Vapor ORM (queries, models, and relations) for NoSQL and SQL databases
https://docs.vapor.codes/4.0/fluent/overview/
MIT License
1.32k stars 172 forks source link

Hacks for supporting optionals in @Field #720

Closed nashysolutions closed 3 years ago

nashysolutions commented 3 years ago

There is a hack in the code which is highlighted via some annotation. FluentKit > Properties > Field.swift > line 124 Creating issue for visibility.

Great article here for using 'ExpressibleByNilLiteral' to handle optionals in property wrappers.

0xTim commented 3 years ago

@nashysolutions what's the actual issue? You can use @Field with optional fields but since there's a lot more going on that just ExpressibleByNilLiteral (like custom encoding and decoding for the database layer) you should use @OptionalField