百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

apollo_upload_server-ruby

> 后端框架
开源

ApolloUploadServer 中间件允许您使用 graphql-ruby、apollo-upload-client 和 Ruby on Rails 上传文件。注意:此实现基于 Ruby on Rails。

189 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

ApolloUploadServer 中间件允许您使用 graphql-ruby、apollo-upload-client 和 Ruby on Rails 上传文件。注意:此实现基于 Ruby on Rails。

ApolloUploadServer

Middleware which allows you to upload files using graphql-ruby, apollo-upload-client and Ruby on Rails.

Note: this implementation uses v2 of the GraphQL multipart request spec, so you should use apollo-upload-client library >= v7.0.0-alpha.3. If you need support for v1 of the GraphQL multipart request spec, you must use version 1.0.0 of this gem.

Installation

Add this line to your application's Gemfile:

ruby
gem 'apollo_upload_server', '2.1'

And then execute:

$ bundle

Or install it yourself as:

$ gem install apollo_upload_server

Middleware will be used automatically.

Gem adds custom Upload type to your GraphQL types. Use ApolloUploadServer::Upload type for your file as input field:

ruby
  input_field :file, ApolloUploadServer::Upload

That's all folks!

Configuration

The following configuration options are supported:

Strict Mode

This can be set on ApolloUploadServer::Middleware:

ruby
ApolloUploadServer::Middleware.strict_mode = true

Doing so ensures that all mapped array values are present in the input. If this is set to true, then for following request:

json
{
  "operations": {
    "query": "mutation { ... }",
    "operationName": "SomeOperation",
    "variables": {
      "input": { "id": "123", "avatars": [null, null] }
    }
  }
}

A mapping for variables.input.avatars.0 or variables.input.avatars.1, will work, but one for variables.input.avatars.100 will not, and will raise an error.

In strict mode, passing empty destination arrays will always fail.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jetruby/apollo_upload_server-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Tests can be run via bundle exec rspec.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the ApolloUploadServer project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About JetRuby

ApolloUploadServer is maintained and founded by JetRuby Agency.

We love open source software! See our projects or contact us to design, develop, and grow your product.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rubygraphqlmiddlewarerailsruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类后端框架
定价开源

> 相关工具

N
Node.js
基于 V8 的 JavaScript 运行时
D
Django
Python 高级 Web 框架
S
Spring Boot
Java 生态主流微服务框架