Add links attribute and gem setup fixes#105
Conversation
|
I didn't address on this PR, but there's seems to be a error being improperly raised on this spec. with an exception
E, [2024-08-14T11:13:38.439786 #77087] ERROR -- : undefined method `raise_error!' for an instance of NotesController (NoMethodError)
/home/jpechaves/Github/jsonapi.rb/spec/dummy.rb:148:in `update'
/home/jpechaves/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.0/lib/action_controller/metal/basic_implicit_render.rb:8:in `send_action'
/home/jpechaves/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.0/lib/abstract_controller/base.rb:226:in `process_action'
/home/jpechaves/.asdf/installs/ruby/3.3.4/lib/ruby/gems/3.3.0/gems/actionpack-7.2.0/lib/action_controller/metal/rendering.rb:193:in `process_action'
# ...
is expected to contain exactly {"code"=>nil, "detail"=>nil, "links"=>nil, "source"=>nil, "status"=>"500", "title"=>"Internal Server Error"} |
|
Thank you @sosolidkk
I don't think The rest of the changes look good. |
The code attribute is also not required but was added. The doc states that an error object MAY have the following members, and MUST contain at least one of those: If we think about the requirement of those merbers, only the In any case, if you'd prefer to not enforce it, I can revert the changes and keep only the other two. |
What is the current behavior?
bundle exec rake spec.linksattributes as per JSON:API Specification.What is the new behavior?
1. Solved an issue with Rails
secret_key_baseconfigI couldn't find any mention of
secretsorsecrets.ymlin the project, and it also doesn't have an encrypted secrets file (credentials,secrets.yml.enc), any.envfile or a in instruction on README to add the expect ENV var. Because of this, every time I tried to run the project, I encountered the following error:To address this, I updated the configuration to match what the Rails::Application object expects. Now, the specs and gem setup work correctly, allowing the tests and QA rake tasks to run as expected without any additional changes.
2. Resolved an Issue with the 422 Error Description
The Rack utils.rb defines the HTTP 422 error as Unprocessable Content, but the specs expect it to be Unprocessable Entity. I'm not entirely sure which is correct, but according to the specification, it should be Unprocessable Content. In any case, I've updated the specs to accept both.
3. Added
linksAttribute inErrorSerializerI implemented a monkey patch in my app to provide this attribute, but I believe it should be included by default, similar to how the
codeattribute was previously added. Here's the specification reference for this attribute:Checklist
Please make sure the following requirements are complete:
features)