Skip to content

Japx.Decoder.Options to exclude relationships if it's empty#43

Merged
fgulan merged 8 commits into
infinum:masterfrom
MadGeorge:master
Sep 2, 2021
Merged

Japx.Decoder.Options to exclude relationships if it's empty#43
fgulan merged 8 commits into
infinum:masterfrom
MadGeorge:master

Conversation

@MadGeorge

Copy link
Copy Markdown
Contributor

According to the JSON:API docs:

A “relationship object” MUST contain at least one of the following:

  • links: a links object containing at least one of the following:self: a link for the relationship itself (a “relationship link”).
  • data: resource linkage
  • meta: a meta object that contains non-standard meta-information about the relationship.

Current implementation breaks this requirement.
An empty JSON object will be sent when no relationships are provided.

"relationships": {}

This leads to API incompatibility with servers with strict validation rules on incoming request data.

The solution we introduce is the encoding option to exclude "relationships" object if it's empty.

Since other apps may rely on current library behavior, we leave the default option to send the empty object, so it will not require any changes on update.

@Truba Truba left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one 👍

Comment thread Japx/Classes/Core/Japx.swift Outdated
Comment thread Japx/Classes/Core/Japx.swift Outdated
MadGeorge and others added 4 commits August 23, 2021 14:27
Co-authored-by: Vlaho Poluta <v.poluta@hotmail.com>
Co-authored-by: Vlaho Poluta <v.poluta@hotmail.com>

@fgulan fgulan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MadGeorge excellent job! 🎉 Could you just please resolve the merge conflict and we'll merge this right away. It will be included in next release this week.

Comment thread Japx/Classes/Core/Japx.swift Outdated
Co-authored-by: Filip Gulan <gulan.filip@gmail.com>
@MadGeorge

Copy link
Copy Markdown
Contributor Author

@MadGeorge excellent job! 🎉 Could you just please resolve the merge conflict and we'll merge this right away. It will be included in next release this week.

Suddenly there is no option to resolve conflicts from web ui. Need time to understand how to do it manually.

CleanShot 2021-09-02 at 16 50 27@2x

@Dundo7

Dundo7 commented Sep 2, 2021

Copy link
Copy Markdown
Contributor

Hi @MadGeorge, if it is fine with you, I can take it from there and resolve the merge conflict.

@MadGeorge

Copy link
Copy Markdown
Contributor Author

Hi @MadGeorge, if it is fine with you, I can take it from there and resolve the merge conflict.

Hello. totally fine

@fgulan fgulan merged commit 7e5c721 into infinum:master Sep 2, 2021
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.

4 participants