We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accept: multipart/vnd.delftsolutions Accept-Multipart: multipart/vnd.delftsolutions; scope=multipart/*, multipart/related, text/html; scope=multipart/*#multipart/*
class BookshelfValidator include MediaTypes::Serialization::MultipartValidator use_name 'bookshelf' validations version: 1 do |view, version| has_one name: :key # defaults to text/plain has_multiple name: :image do optional allow raw: 'image/*' end allow_others do allow serialized: BookSerializer, version: 1 end end end class BookshelfSerializer < MediaTypes::Serialization::Base multipart BookshelfValidator input do |parts, mapped, context| return new Bookshelf(mapped.key, mapped.image, parts.select { |p| p.name.nil? }) end output do |shelf, context| part name: :key, disposition: 'form-data' do # Defaults to text/plain render_media shelf.key end shelf.images.each do |i| part name: :image, disposition: 'attachment', filename: i.filename do allow_raw i.content_type render_media i end end shelf.books.each do |book| part do allow_serializer BookSerializer, version: 1 allow_serializer BookSerializer, view: :html, version: 1 render_media book end end end end
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The text was updated successfully, but these errors were encountered: