Skip to content

Conversation

vasilakisfil
Copy link
Contributor

Purpose

Simple doc for relationship links. I, personally had issues with relationship links, took me 4 hours to figure out how to add them in JSONAPI and I am not a newcomer in this project. I think we need this.

Changes

Just a markdown file

Caveats

I also add a note about empty relationship but WITH links, taken from here #1325 and here #1720

Related GitHub issues

#1325
#1720

Additional helpful information

@mention-bot
Copy link

@vasilakisfil, thanks for your PR! By analyzing the annotation information on this pull request, we identified @joaomdmoura, @bf4 and @NullVoxPopuli to be potential reviewers

@vasilakisfil vasilakisfil force-pushed the docs/links branch 3 times, most recently from b6c7570 to 3343cc0 Compare September 3, 2016 16:04
@NullVoxPopuli
Copy link
Contributor

Thanks so much for this!

```


### Links as an property of the resource definiton
Copy link
Contributor

Choose a reason for hiding this comment

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

should read: "Links as a property"

@NullVoxPopuli
Copy link
Contributor

looks good, just needs some grammatical updates


AMS offers you many ways to add links in your JSON, depending on your needs.

The following examples are in Rails but the logic is the same for any framework
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this true? none of the controllers (or even the serializers) have a superclass.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes I always use a BaseXXX class. I will just add the ApplicationController and ActiveModel::Serializer in the code examples.

@vasilakisfil
Copy link
Contributor Author

Fixed what you told me, rebased + squashed.

ActiveModelSerializers offers you many ways to add links in your JSON, depending on your needs.
Usually the most common use case for links is supporting nested resources.

The following examples are in Rails but the logic is the same for any framework
Copy link
Contributor

Choose a reason for hiding this comment

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

Having two sentences start with the same phrase kinda feels awkward. :-\ idk

@vasilakisfil vasilakisfil force-pushed the docs/links branch 3 times, most recently from b059268 to 56b3dab Compare September 4, 2016 20:05
@vasilakisfil
Copy link
Contributor Author

Fixed what you told me, rebased + squashed.

@vasilakisfil
Copy link
Contributor Author

@NullVoxPopuli sure do how you like :) let me know if you need any help!

@NullVoxPopuli
Copy link
Contributor

@vasilakisfil I submitted a PR to your repo. once that's merged, I'll feel pretty good about merging this.

@vasilakisfil
Copy link
Contributor Author

Merged, rebased and squashed!

@NullVoxPopuli
Copy link
Contributor

can you add a changelog entry to give yourself credit? :-)

Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add controller info

Grammar fixing

Improve docs

some small wording changes

Add pr to changelog
@vasilakisfil
Copy link
Contributor Author

Done! Rebased from master + squashed!

@NullVoxPopuli NullVoxPopuli merged commit 50f2754 into rails-api:master Sep 7, 2016
richmolj pushed a commit to richmolj/active_model_serializers that referenced this pull request Sep 16, 2016
Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add docs for links

Add controller info

Grammar fixing

Improve docs

some small wording changes

Add pr to changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants