Title: Support conditional link serialization format · Issue #27 · JSONAPIdotNET/JSONAPI.NET · GitHub
Open Graph Title: Support conditional link serialization format · Issue #27 · JSONAPIdotNET/JSONAPI.NET
X Title: Support conditional link serialization format · Issue #27 · JSONAPIdotNET/JSONAPI.NET
Description: This would be a really killer feature for my project. I have some ember routes that fetch a decently complex graph of data, and there's really no good way to inform the server that this particular route needs to side-load deeply, while m...
Open Graph Description: This would be a really killer feature for my project. I have some ember routes that fetch a decently complex graph of data, and there's really no good way to inform the server that this particular ...
X Description: This would be a really killer feature for my project. I have some ember routes that fetch a decently complex graph of data, and there's really no good way to inform the server that this particu...
Opengraph URL: https://github.com/JSONAPIdotNET/JSONAPI.NET/issues/27
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support conditional link serialization format","articleBody":"This would be a really killer feature for my project. I have some ember routes that fetch a decently complex graph of data, and there's really no good way to inform the server that this particular route needs to side-load deeply, while maintaining the ability to return sparse results at other times (say, when loading a list).\n\nFor a simple example. I have a resource called `Organization`, which has many `Notes`. Notes have a `User` that entered the note. When I load an organization detail record, I want to load all the notes for that organization, as well the user that entered each note, preferably all in a single AJAX request. However if I am on a route where I need to fetch a list of Organizations, I only want to serialize an href to fetch the related records. As far as I can tell, this kind of conditional link formatting isn't yet possible. [The spec](http://jsonapi.org/format/#fetching-includes) has a solution for this, by allowing the client to specify resource paths to include.\n\nI'm happy to put in the legwork toward implementing this feature, but I want to make sure I get the architecture right. The first step is to add a parameter to the Get methods on ApiController\u003cT\u003e to gain access to the `include` query param. After that I'm not sure, I guess we have to change the IMaterializer interface somehow to allow the ApiController to tell the provider what to include. Then here comes the hard part: How do we tell the formatter to override its own strategy for resource linking behavior, and instead use what the client sent? Remember, MediaTypeFormatter does not have access to the request context.\n\nTwo potential solutions occur to me:\n1. Make the formatter not be in charge of deciding what relationships to serialize at all. We add another action filter that runs after our other filters (filter, sort, enumerate). This filter would consult the IModelManager, and then modify the object content to return an ExpandoObject, and all the formatter has to do is serialize that to JSON.\n2. Still add another action filter, but instead of using the model manager, have it wrap the content in some sort of object that contains hints for the formatter to tell it what relationships to serialize. The formatter would be changed to handle this new object if it sees it, and fall back to the existing behavior if it is passed something else.\n#2 is less of a drastic change and I think I prefer it, just wanted to get your thoughts. Am I missing something obvious?\n","author":{"url":"https://github.com/csantero","@type":"Person","name":"csantero"},"datePublished":"2015-01-26T22:39:48.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":10},"url":"https://github.com/27/JSONAPI.NET/issues/27"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:c5aa0d81-566c-c6bc-147b-72901dc3a6e6 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D0D8:13EE66:101E14F:16DC651:6A50B1AA |
| html-safe-nonce | 457e112e217ae29566133e1d871bb23c52722f9cc4dce2fac09e13846ed8dc98 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMEQ4OjEzRUU2NjoxMDFFMTRGOjE2REM2NTE6NkE1MEIxQUEiLCJ2aXNpdG9yX2lkIjoiNjMxOTYwMzQwOTI2MDQyNTY0MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 771eb3ed7edd8397a268f821828b4151bb28e5952b38430d6e8e6d1c79cc2b6e |
| hovercard-subject-tag | issue:55548273 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/JSONAPIdotNET/JSONAPI.NET/27/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9b4c64dfd6e9dc202a3d15ea60fe7f6c6c22d4324879eed2df73da6fade2aa95/JSONAPIdotNET/JSONAPI.NET/issues/27 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9b4c64dfd6e9dc202a3d15ea60fe7f6c6c22d4324879eed2df73da6fade2aa95/JSONAPIdotNET/JSONAPI.NET/issues/27 |
| og:image:alt | This would be a really killer feature for my project. I have some ember routes that fetch a decently complex graph of data, and there's really no good way to inform the server that this particular ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | csantero |
| hostname | github.com |
| expected-hostname | github.com |
| None | d6dc8294eb500fa36bbc57472d61fe87c522f9c3c1d64f70f4926f66a66a7efb |
| turbo-cache-control | no-preview |
| go-import | github.com/JSONAPIdotNET/JSONAPI.NET git https://github.com/JSONAPIdotNET/JSONAPI.NET.git |
| octolytics-dimension-user_id | 16112275 |
| octolytics-dimension-user_login | JSONAPIdotNET |
| octolytics-dimension-repository_id | 27474358 |
| octolytics-dimension-repository_nwo | JSONAPIdotNET/JSONAPI.NET |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27474358 |
| octolytics-dimension-repository_network_root_nwo | JSONAPIdotNET/JSONAPI.NET |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7ac0ad2f2c7e4b9056617355fd9e33e22b0c8df9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width