jsonapi-parser icon indicating copy to clipboard operation
jsonapi-parser copied to clipboard

fix top-level resource optional id & add test cases for type/id requirements

Open nruth opened this issue 7 years ago • 1 comments

on client requesting to create a resource on the server

This happened after seeing https://github.com/jsonapi-rb/jsonapi-deserializable/issues/21 and trying to figure out whether I can use that or not (after having false starts with a lot of ruby json-api libraries).

The code was already structured to handle the optional top-level id, it just seems be wired up wrong and was missing a test case. This will need a review as I'm not 100% sure of what the spec says, especially about the case where the top-level is an array of resource objects rather than a single one. I think this makes sense, but it might be wrong.

nruth avatar Aug 09 '18 01:08 nruth

Codecov Report

Merging #13 into master will increase coverage by 0.84%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #13      +/-   ##
==========================================
+ Coverage   80.67%   81.51%   +0.84%     
==========================================
  Files           5        5              
  Lines         119      119              
==========================================
+ Hits           96       97       +1     
+ Misses         23       22       -1
Impacted Files Coverage Δ
lib/jsonapi/parser/document.rb 84.26% <100%> (+1.12%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 1ab3d35...4625478. Read the comment docs.

codecov-io avatar Aug 09 '18 01:08 codecov-io