media-ui icon indicating copy to clipboard operation
media-ui copied to clipboard

Get rid of `t3n/graphql` dependency

Open bwaidelich opened this issue 3 years ago • 9 comments

The t3n/graphql package offers some great tools, especially to get started. But it has some slight drawbacks:

  • Incompatibilities with current packages (e.g. webonyx/graphql-php ~0.13 vs 14.11.5, via t3n/graphql-tools)
  • Increased complexity and source of possible bugs
  • Limited options for (performance) optimizations

For the Media UI package it should be enough to create a really slim layer over (a recent version of) webonyx/graphql-php

bwaidelich avatar Feb 18 '22 12:02 bwaidelich

Sounds great. In the beginning we thought introducing a GraphQL package to the core would also increase usage and more 3rd party GraphQL apis via community packages. We should still keep that in mind a bit.

Sebobo avatar Feb 24 '22 09:02 Sebobo

Another point is that the media-ui cannot be tested and used with PHP 8 because t3n/graphql-upload is set to PHP ^7.3

jonnitto avatar Feb 27 '22 19:02 jonnitto

Core GraphQL sounds amazing, but is also not easy to maintain i can imagine

mhsdesign avatar Mar 10 '22 15:03 mhsdesign

From Slack:

FYI: I think https://graphqlite.thecodingmachine.io/ could be a good replacement for the GraphlQL libraries. It's a layer on top of webonyx/graphql-php that allows to use PHPs type system and annotations to create GraphQL schema and resolvers. I experimented a bit with it and we need some glue code to make it play nicely with Flow. That could go into some kind of small "Neos bundle" package. I'll test some more, but if anyone is interested in a discussion.. anytime! For now I'll try to add that glue code to the flowpack/media-ui package (...) to see if it really works out in practice

bwaidelich avatar Apr 07 '22 12:04 bwaidelich

The "graphqlite.thecodingmachine.io"-approach didn't really work out for me because:

  • it comes with quite a lot of additional boiler plate
  • it's meant to be used as code-first approach
  • it uses runtime reflection to detect implementation classes

My current idea would be a package that generates PHP classes (i.e. value objects) for a given schema file and the minimal glue code. This should be fairly simple(tm) in general. But it would be nice of course if the generated code could be edited and re-generated without losing changes (maybe with the help of https://getrector.org/)

I currently don't get around working on that, but I didn't forget about this issue.

bwaidelich avatar Jun 14 '22 13:06 bwaidelich

FYI: In the meantime I have completely rewritten Wwwision.GraphQL It follows a different approach than described above by going a PHP-first approach, but it might be a good fit anyways. I hope that I can give it a go at some point, but please don't rely on it as I still have to iron out some things first

bwaidelich avatar Sep 07 '23 10:09 bwaidelich

I just opened https://github.com/t3n/graphql-tools/issues/49 when I realized the transitive dependency on webonyx/graphql-php is horribly outdated (~0.13 – current is 15.12)…

kdambekalns avatar Jun 28 '24 09:06 kdambekalns

I actually wanted to check how much effort it would be to switch from GraphQL to REST again. The PHP side should be manageable, but in the JS part I would have to check how well the Apollo RestAdapter works.

Sebobo avatar Jun 28 '24 10:06 Sebobo