Giter Site home page Giter Site logo

graphql-upload's People

Contributors

dependabot-preview[bot] avatar fezfez avatar powerkiki avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-upload's Issues

Make v5 allow PHP 8

Hey, I recently stumbled across this and project and I am using it and loving it, thanks for the great work!

I am using it in conjunction with PHP 8 and thecodingmachine/graphqlite.

graphqlite has a requirement for webonyx/graphql-php ^v0.13.4 (https://github.com/thecodingmachine/graphqlite/blob/master/composer.json#L14).

graphql-upload v6 requires webonyx/graphql-php ^14.

Therefore currently I can only use graphql-upload v5 together with graphqlite. But graqhl-upload v5 does not support PHP 8, so it is impossible to use graphql-php in my setup. That is why I created a fork and tagged a 5.0.1 which allows PHP 8.

This is all I had to do: svnldwg-forks@57b5d83

It works, but I would love to get rid of my fork and just use the original project. Could you allow PHP 8 for v5?

Zend only?

So just checking, this middleware only works with the zend framework?

Would you be interested in turning this package into a generic repository for graphql upload middlewares, e.g. I could create a LaravelUploadMiddleware?

Warning on invalid mapping

If you map indexes to the variables, but attach not enough uploads, the warning is shown. I think it should be an exception, maybe as a part of request validation.

It's caused by:

$items = $request->getUploadedFiles()[$fileKey];

Inconsistent PSR-15 request manipulation

When using this lib in middleware, the request body is parsed and re-attached to the request object that's piped through, if there are uploadedFiles. However, if there are not, the request is not parsed. Additionally, the stream is no longer available in the request object that's piped through the middleware, so you're unable to rewind and reparse, if needed.

This inconsistency is causing issues. I get that the request object needs to be modified, but the stream should at least be maintained, at the least. Or maybe just don't return a parsedBody at all. The real issue is that the parsing of the body isn't deep in it's JSON decoding. So, you can't even use it and you have to do a whole bunch of validation checks on the state of the parsedBody for it to be usable.

How to test?

How to use postman or insomnia to test file upload?

What is the query looks like?

Middleware with slim framework

does UploadMiddleware works with slim middlework?

I have added this middleware to slim using
$app->add(new UploadMiddleware());

but it throws a below error

[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "RuntimeException: {} is not resolvable in /var/www/html/php/vendor/slim/slim/Slim/CallableResolver.php:104"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "Stack trace:"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#0 /var/www/html/php/vendor/slim/slim/Slim/CallableResolver.php(56): Slim\CallableResolver->assertCallable(Object(GraphQL\Upload\UploadMiddleware))"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#1 /var/www/html/php/vendor/slim/slim/Slim/CallableResolverAwareTrait.php(45): Slim\CallableResolver->resolve(Object(GraphQL\Upload\UploadMiddleware))"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#2 /var/www/html/php/vendor/slim/slim/Slim/DeferredCallable.php(36): Slim\DeferredCallable->resolveCallable(Object(GraphQL\Upload\UploadMiddleware))"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#3 [internal function]: Slim\DeferredCallable->__invoke(Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#4 /var/www/html/php/vendor/slim/slim/Slim/MiddlewareAwareTrait.php(70): call_user_func(Object(Slim\DeferredCallable), Object(Slim\Http\Request), Object(Slim\Http\Response), Object(Closure))"
[22-Aug-2018 05:52:33] WARNING: [pool www] child 98 said into stderr: "#5 /var/www/html/php/vendor/tuupola/callable-handler/src/CallableHandler.php(34): Slim\App->Slim\{closure}(Object(Slim\Http\Request), Object(Slim\Http\Response))"

Laravel

I was looking into adding uploads to graphql and i am using Folkloreatelier/laravel-graphql.
But I don't understand how to implement the middleware into Folkloreatelier/laravel-graphql.
As explained in #1 I should use a bridge. But I cant get it working. Could you help me?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.