-
Notifications
You must be signed in to change notification settings - Fork 82
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
Param not allowed #51
Comments
Hey there! Well, I see that the The weird thing is that your said it wasn't happening with JR 🤔 Anyway, can you check the creatable fields of your resource, and give me feedback: Api::V1::PlanResource.creatable_fields({}) #=> ? |
Tip: if @result.errors.blank?
jsonapi_render json: @result, status: :created
else
jsonapi_render_errors json: @result, status: :unprocessable_entity
end :-) |
I tested out
yea, it wasn't happening in JR. ummmm |
Maybe I found out.
|
It should be working fine for those versions you're using. I will try to take a deeper look later. |
I'm also seeing this and I'm using jsonapi-utils 0.5.1 with jsonapi-resources 0.8.3 |
I decided to investigate this case a little bit further and I figured out that the error is occurring due to the configuration of the key formatter that's being used. Say we have this class PostResource < JSONAPI::Resource
attributes :title, :body, :user_id
has_one :author
end When the request is parsed – using the JR's Long story short, it's checking this: %i(user-id).include?(:user_id) #=> false See what happens when JR parses the request: To confirm the hypothesis then I looked for the key formatter: [8] pry> JSONAPI.configuration.json_key_format
#=> :dasherized_key So hopefully in order to fix this issue you just need to set the proper key formatter: # config/initializers/jsonapi-resouces.rb
JSONAPI.configure do |config|
# ...
config.json_key_format = :underscored_key
end |
Hey, sorry for the late reply. Actually, I found that I set up the I think this is worth to mention in I'll close this issue! yay! |
Hi!
I've been struggling to pass attributes when I migrate JU from JR.
I could turn this
config.raise_if_parameters_not_allowed = true
intofalse
, however I still see some error within meta.Could you suggest how I could work this around?
Maybe
resource_params
checksstripe_plan_id
and raise an error somehow so that it can not reach the endpoint#create
.The text was updated successfully, but these errors were encountered: