serializing Grape::Entity::Exposure::NestingExposure::OutputBuilder fails in 0.7.0
还没有人认领这个 Issue。
评估
调研方向
Start by reproducing the failure with Marshal.dump around the Rails.cache.fetch example, then inspect how the entity options hash carries opts[:env]. Use the listed unmarshalable environment keys to narrow the cause; done means the entity can be serialized for caching without the TypeError while retaining the expected output.
由索引模型根据 Issue 内容生成。
描述
When attempting to serialize a Grape::Entity::Exposure::NestingExposure::OutputBuilder in 0.7.0 using Marshal.dump (for caching), we encounter an error like TypeError: can't dump IO.
Rails.cache.fetch(key) do
present(entity_items).as_json # this used to just give a Hash which could be marshaled properly
end
This error seems to stem from the options hash in the entity. When it contains the request environment (in the :env key), there are objects that cannot be marshaled.
In my testing (in development mode) the following keys contain unmarshalable items.
opts[:env].reject {|k,v| Marshal.dump(v) rescue false }.keys
["rack.errors",
"puma.socket",
"rack.hijack",
"puma.config",
"action_dispatch.logger",
"action_dispatch.backtrace_cleaner",
"action_dispatch.routes",
"action_dispatch.remote_ip",
"rack.session",
"rack.session.options",
"warden",
"grape.routing_args",
"api.endpoint"]
- 主要语言
- Ruby
- 星标
- 730
- 派生
- 154
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
ruby-grape/grape-entity 的其他 Issue
-
难度 5/5 一周以上 新手友好度 25/100
ruby-grape/grape-entity#386 · 7 条评论 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 35/100
ruby-grape/grape-entity#382 ·
-
难度 4/5 3-5 天 新手友好度 35/100
ruby-grape/grape-entity#380 ·
-
难度 3/5 1-2 天 新手友好度 35/100
ruby-grape/grape-entity#373 · 2 条评论 ·
-
难度 1/5 1-3 小时 新手友好度 45/100
ruby-grape/grape-entity#372 ·
查看 ruby-grape/grape-entity 的全部 Issue
相似的 Issue
-
Unconfirmed users who reset their password are stuck on sign in with no way to send confirmation未关闭
难度 2/5 1-3 小时 新手友好度 79/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
L: github:actions L: javascript
难度 2/5 1-3 小时 新手友好度 75/100
dependabot/dependabot-core#16615 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 61/100
hitobito/hitobito_pfadi_de#164 ·
维护者通常 5 天内回复
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 7 天内回复