vapor / template-kit

📄 Easy-to-use foundation for building powerful templating languages in Swift.
MIT License
46 stars 17 forks source link

Added support for passing userInfo to Encoder #61

Open foscomputerservices opened 5 years ago

foscomputerservices commented 5 years ago

This change allows the userInfo passed to render to be passed down the TemplateDateEncoder chain. This provides for the ability for Request-level information to be passed all the way into the view model during the Encoder process.

The only minor quirk is that the type on userInfo passed to render is very broad [AnyHashable: Any] where the type on Encoder.userInfo is [CodingUserInfoKey: Any]. I opted to filter for the subset and document the filter. I'm happy to consider alternatives.

Any feedback on alternatives to making such information available are happily accepted.

foscomputerservices commented 5 years ago

I'm not sure why this performance test would fail. No code changes affect the performance-tested code, I've double-checked...