Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

serializing Grape::Entity::Exposure::NestingExposure::OutputBuilder fails in 0.7.0

Đang mở
#299 9 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
rails, ruby
Lĩnh vực
api, backend

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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"]
Ngôn ngữ chính
Ruby
Star
730
Fork
154
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ruby-grape/grape-entity

Tất cả issue của ruby-grape/grape-entity

Issue tương tự

Thêm issue về Ruby

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.