vapor / fluent-kit

Swift ORM (queries, models, and relations) for NoSQL and SQL databases
MIT License
207 stars 116 forks source link

Page<T> where T: Encodable does not seem to be allowed to be extendable #548

Open jcbriones opened 1 year ago

jcbriones commented 1 year ago

Describe the bug

Not sure if this is really a bug but I'm trying to extend the Page struct from FluentKit on my project and it's saying that the T is not conforming to Encodable but it seems it is extending the Page to Encodable. I am guessing it migh be because the extension was internal and not set to public? This is the error I am getting

image

Type 'T' does not conform to protocol 'Encodable'

To Reproduce

Steps to reproduce the behavior:

  1. Create a protocol and inside the protocol to use the page's items.
  2. Create an extension for Page that uses the protocol
  3. You'll get the error that T is not encodable.

Expected behavior

That T is encodable even when used in an extension.

Environment

Additional context

You can message me directly if you'd like to do one on one to figure out the issue.

jcbriones commented 1 year ago

Just realized that T does not conform to Encodable or Decodable. It's just an extension where T is encodable or decodable. Is there a reason why T does not directly conform to codable?