Skip to content
New issue

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

Documentation on the ErrorSerializer #83

Open
dja opened this issue Feb 16, 2018 · 3 comments
Open

Documentation on the ErrorSerializer #83

dja opened this issue Feb 16, 2018 · 3 comments
Labels

Comments

@dja
Copy link

dja commented Feb 16, 2018

I've tried getting it to serialize ActiveModel errors, but to no avail.

Here's what I've got going on..

I've tried both of these for good measure.

# /api/v1/defaults.rb
error_formatter :json, Grape::Formatter::ActiveModelSerializers
error_formatter :jsonapi, Grape::Formatter::ActiveModelSerializers
# api/v1/users.rb, includes defaults

params do
  requires :id, types: String, desc: 'User ID'
end
route_param :id do
  before do
    @user = User.where(id: params[:id]).first!
  end

  desc 'Update a user'
  params do
    optional :first_name, type: String, desc: 'First Name'
    optional :last_name, type: String, desc: 'Last Name'
    optional :email, type: String, desc: 'Email Address'
  end
  patch do
      @user.update(params)
  end
end

Any suggestions greatly appreciated!

@dblock
Copy link
Member

dblock commented Feb 18, 2018

Maybe turn it into a spec and we can take a look?

@dblock dblock added the bug? label Feb 18, 2018
@dja
Copy link
Author

dja commented Feb 27, 2018

Looks like the PRs for error_formatter being added didn't include a version bump and republish to ruby gems... The latest version published is 1.5.1.

#80

@dblock
Copy link
Member

dblock commented Feb 28, 2018

Are you saying HEAD has the code that works? If so you can close this.

I opened #84 to do a release, hopefully soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants