Skip to content

Conversation

alonewarrior
Copy link
Contributor

Fixes issue involving a targeted unconvert case and an alternative key wherein the alternative key could be reached due to a match for the unconverted case not existing.

This issue arose when the data to be deserialized was in a particular case (specified by the convert case), but it would not properly use the alternative key due to the relation key having not been unconverted yet.

Example:

      Serializer.register('articles', {
        unconvertCase: 'snake_case',
        relationships: {
          article_author: {
            alternativeKey: 'article_author_id',
            type: 'authors',
          },
        }
      });
      const data = {
        data: {
          type: 'article',
          id: '1',
          attributes: {
            createdAt: '2015-05-22T14:56:29.000Z'
          },
          relationships: {
            articleAuthor: {
              data: {
                type: 'people',
                id: '1'
              }
            }
          }
        }
      };

"articleAuthor" does not get deserialized to "article_author_id" in this particular case without these changes.

…y wherein the alternative key could be reached due to a match for the unconverted case not existing

Adds .idea to .gitignore

Updated version to 1.15.1
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0a74ef5 on alonewarrior:master into 3a36b33 on danivek:master.

2 similar comments
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0a74ef5 on alonewarrior:master into 3a36b33 on danivek:master.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0a74ef5 on alonewarrior:master into 3a36b33 on danivek:master.

@coveralls
Copy link

coveralls commented May 2, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling d555ffe on alonewarrior:master into 3a36b33 on danivek:master.

@danivek danivek merged commit 9af5c72 into danivek:master May 3, 2019
@danivek
Copy link
Owner

danivek commented May 3, 2019

@alonewarrior Thanks for the PR !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants