juancastillo0 / leto

Dart GraphQL server libraries. Utilities, code generator, examples and reference implementation.
https://juancastillo0.github.io/leto/
MIT License
38 stars 6 forks source link

GraphQL @defer and @stream #26

Open luissantos opened 3 months ago

luissantos commented 3 months ago

Hi everyone,

Thanks for the amazing work you have been doing. Really like the way this server was built and fact that it can be used in so many configurations. There is a bit of a learning curve but its very flexible.

Any plans to support the @defer and @stream directives? How easy would it be to implement these 2 without including it in leto?

I would love to help implement it but I don't know where to start. Any guidance on this would be very much appreciated.

Thanks

juancastillo0 commented 1 month ago

Hi sorry for the late response

I would love to help implement it but I don't know where to start. Any guidance on this would be very much appreciated.

I think you could start with the '@skip' and '@include' directives that are already implemented.

The configuration: https://github.com/juancastillo0/leto/blob/8778144bce1ba0dbf65253ee1d78316d2162cbc1/leto_schema/lib/src/directive.dart#L161 and implementation: https://github.com/juancastillo0/leto/blob/8778144bce1ba0dbf65253ee1d78316d2162cbc1/leto_schema/lib/src/utilities/collect_fields.dart#L19

I believe it will require changes to executeRequest in leto (or the functions it calls) and the http response handling in leto_shelf.