Clarify how to conform to NodeRepresentable
acecilia opened this issue · 1 comments
acecilia commented
When using paginator with a model, which code comes from the Vapor default implementation, the compiler says:
Type 'Location' does not conform to protocol 'NodeRepresentable'
Then, I make it conform by adding:
extension Location: NodeRepresentable { }
And when running I get a runtime error:
[FluentProvider.FluentModelError: invalidContext(Optional(Node.ObjectContext<Swift.String, Swift.Int>))]
Conform 'FluentProvider.FluentModelError' to Debugging.Debuggable to provide more debug information.
In the end I solved it by conforming to NodeRepresentable this way:
extension Location: NodeRepresentable {
func makeNode(in context: Context?) throws -> Node {
return try makeJSON().makeNode(in: context)
}
}
Is this the right way to do it? If yes, please clarify it in the readme.
steffendsommer commented
This shouldn't be an issue anymore - feel free to re-open if it is