mongodb-vapor
mongodb-vapor copied to clipboard
Update ContentEncoder/ContentDecoder support
Vapor 4.75.0 overhauled how the Validation module works. Unfortunately, in order to correct several issues with the old implementation without breaking API, the ContentEncoder
and ContentDecoder
protocols had to add new method requirements which allow specifying userInfo
dictionaries on a per-encode/decode basis. While default implementations which invoke the legacy methods were provided for source compatibility, any custom coders conforming to these protocols no longer work when used for Validation (or with ContentContainer
's subscripts and get()
methods) until they are updated accordingly.
In accordance with this concern (and since I'm the one who made the aforementioned changes and broke things 😅), I've provided the appropriate updates for ExtendedJSONEncoder
and ExtendedJSONDecoder
, and a simple test to ensure it now works.
(Note: It is not necessary to require Vapor 4.75.0 in Package.swift
; the new logic is purely additive and will have no impact if used with earlier versions.)