{"action":"created","issue":{"url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/27","repository_url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework","labels_url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/27/comments","events_url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/27/events","html_url":"https://github.com/scott-mcdonald/JsonApiFramework/issues/27","id":201658809,"number":27,"title":"Can we have a ResourceCollection() under Resource()?","user":{"login":"vinaysharma77","id":3733770,"avatar_url":"https://avatars.githubusercontent.com/u/3733770?v=3","gravatar_id":"","url":"https://api.github.com/users/vinaysharma77","html_url":"https://github.com/vinaysharma77","followers_url":"https://api.github.com/users/vinaysharma77/followers","following_url":"https://api.github.com/users/vinaysharma77/following{/other_user}","gists_url":"https://api.github.com/users/vinaysharma77/gists{/gist_id}","starred_url":"https://api.github.com/users/vinaysharma77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinaysharma77/subscriptions","organizations_url":"https://api.github.com/users/vinaysharma77/orgs","repos_url":"https://api.github.com/users/vinaysharma77/repos","events_url":"https://api.github.com/users/vinaysharma77/events{/privacy}","received_events_url":"https://api.github.com/users/vinaysharma77/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-01-18T18:44:57Z","updated_at":"2017-01-30T02:17:46Z","closed_at":"2017-01-18T19:14:53Z","body":".Net version 4.5.\r\n\r\nI have an object called Process and under that I have collection of Activities\r\n\r\n{\r\n\"processDocument\": [\r\n{\r\n\"jsonapi\": {\"version\": \"1.1\"},\r\n\"data\": {\r\n\"type\": \"process-model\",\r\n\"id\": \"510003\",\r\n\"attributes\": {\r\n\"process-id\": 510003,\r\n\"process-name\": \"Process123\",\r\n\"enabled\": true,\r\n\"activities\": [\r\n{\r\n\"processId\": 510003,\r\n\"activityId\": 510005,\r\n\"activityName\": \"Activity 1\"\r\n},\r\n{\r\n\"processId\": 510003,\r\n\"activityId\": 510054,\r\n\"activityName\": \"Activity 2\"\r\n},\r\n{\r\n\"processId\": 510003,\r\n\"activityId\": 510004,\r\n\"activityName\": \"Activity 3\"\r\n}\r\n]\r\n}\r\n}\r\n}\r\n]\r\n}\r\n\r\nHere's what I'm trying to accomplish:\r\n\r\nI want to be able to get the fully qualified links for each item in the activity collection. I'm able to output the above json without links by this code:\r\n\r\n           var processdoc = documentContext\r\n                .NewDocument(HttpContext.Current.Request.Url)\r\n                    .SetJsonApiVersion(JsonApiVersion.Version11)\r\n                    .Resource(process)\r\n                    .ResourceEnd()\r\n                .WriteDocument();\r\nThe \"process\" object supplied to the Resource() method above contains the Process properties and a collection (List) of activities. The JSON Api doesn't seem to support accessing collection the ResourceCollection() under Resource().. I was expecting to do something like this:\r\n\r\n           var processdoc = documentContext\r\n                .NewDocument(HttpContext.Current.Request.Url)\r\n                    .SetJsonApiVersion(JsonApiVersion.Version11)\r\n                    .Resource(process)                            \r\n                        .ResourceCollection(process.Activities)\r\n                            .Links()\r\n                                .AddSelfLink()\r\n                            .LinksEnd()\r\n                        .ResourceCollectionEnd()\r\n                    .ResourceEnd()\r\n                .WriteDocument();\r\nOr is there some other way to accomplish this using JSON Api that I'm not aware of?\r\n\r\nI was also hoping to convert the property name to camel case (processId, processName) instead of using hyphens (process-id, process-name) in the JSON output. Is that doable in JSON Api?\r\n\r\nAppreciate any help on these.\r\n\r\nVin"},"comment":{"url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/comments/275967228","html_url":"https://github.com/scott-mcdonald/JsonApiFramework/issues/27#issuecomment-275967228","issue_url":"https://api.github.com/repos/scott-mcdonald/JsonApiFramework/issues/27","id":275967228,"user":{"login":"vinaysharma77","id":3733770,"avatar_url":"https://avatars.githubusercontent.com/u/3733770?v=3","gravatar_id":"","url":"https://api.github.com/users/vinaysharma77","html_url":"https://github.com/vinaysharma77","followers_url":"https://api.github.com/users/vinaysharma77/followers","following_url":"https://api.github.com/users/vinaysharma77/following{/other_user}","gists_url":"https://api.github.com/users/vinaysharma77/gists{/gist_id}","starred_url":"https://api.github.com/users/vinaysharma77/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vinaysharma77/subscriptions","organizations_url":"https://api.github.com/users/vinaysharma77/orgs","repos_url":"https://api.github.com/users/vinaysharma77/repos","events_url":"https://api.github.com/users/vinaysharma77/events{/privacy}","received_events_url":"https://api.github.com/users/vinaysharma77/received_events","type":"User","site_admin":false},"created_at":"2017-01-30T02:17:46Z","updated_at":"2017-01-30T02:17:46Z","body":"Scott,\r\n\r\nThere were some realignment of priorities hence  couldn't work on getting a test app ready for you. Apologies for the delay.\r\n\r\nI now have a git repository of my project that reproduces the issue. Here's the link: https://github.com/vinaysharma77/jsonapitest\r\n\r\nyou'll find 3 get routes in the WorkflowController:\r\n\r\napi/workflow\r\napi/workflow/{processName}\r\napi/workflow/{processName}/{activityName}\r\n\r\nThe URL creation for \"api/workflow\" call works fine but when I get a collection (included) of activities in \"api/workflow/{processName}\" the self link URL created for the process and the link for the activities in the collection returned are not accurate. This is the response I get for \"\" call as you can see the segments in the URL returned are duplicated and not in the correct order as supplied in the request URL:\r\n\r\nURL generated for the process is:\r\n\r\n\"http://<server_name>/jsonapitest/api/process1/workflow/process1\"\r\n\r\nIt should be:\r\n\r\n\"http://<server_name>/jsonapitest/api/workflow/process1\"\r\n\r\nURL generated for the activities is:\r\n\r\n\"http://<server_name>/jsonapitest/api/process1/activity-models/activity1\"\r\n\r\nIt should be:\r\n\r\n\"http://<server_name>/jsonapitest/api/workflow/process1/activity1\"\r\n\r\n\r\n{\r\n  \"processDocument\": {\r\n    \"jsonapi\": {\r\n      \"version\": \"1.1\"\r\n    },\r\n    \"data\": {\r\n      \"type\": \"process-detail-models\",\r\n      \"id\": \"process1\",\r\n      \"attributes\": {\r\n        \"process-id\": 1,\r\n        \"process-name\": \"Process 1\",\r\n        \"process-description\": \"This is process 1\",\r\n        \"hide-on-ui\": false,\r\n        \"process-route-name\": \"process1\"\r\n      },\r\n      \"relationships\": {\r\n        \"activities\": {\r\n          \"links\": {\r\n            \"related\": \"http://<server_name>/jsonapitest/api/process1/workflow/process1/activities\"\r\n          },\r\n          \"data\": [\r\n            {\r\n              \"type\": \"activity-models\",\r\n              \"id\": \"activity1\"\r\n            },\r\n            {\r\n              \"type\": \"activity-models\",\r\n              \"id\": \"activity2\"\r\n            },\r\n            {\r\n              \"type\": \"activity-models\",\r\n              \"id\": \"activity3\"\r\n            }\r\n          ]\r\n        }\r\n      },\r\n      \"links\": {\r\n        \"self\": \"http://<server_name>/jsonapitest/api/process1/workflow/process1\"\r\n      }\r\n    },\r\n    \"included\": [\r\n      {\r\n        \"type\": \"activity-models\",\r\n        \"id\": \"activity1\",\r\n        \"attributes\": {\r\n          \"activity-id\": 1,\r\n          \"activity-name\": \"Activity 1\",\r\n          \"activity-desc\": \"This is Activity 1 of Process 1\",\r\n          \"activity-route-name\": \"activity1\"\r\n        },\r\n        \"links\": {\r\n          \"self\": \"http://<server_name>/jsonapitest/api/process1/activity-models/activity1\"\r\n        }\r\n      },\r\n      {\r\n        \"type\": \"activity-models\",\r\n        \"id\": \"activity2\",\r\n        \"attributes\": {\r\n          \"activity-id\": 2,\r\n          \"activity-name\": \"Activity 2\",\r\n          \"activity-desc\": \"This is Activity 2 of Process 1\",\r\n          \"activity-route-name\": \"activity2\"\r\n        },\r\n        \"links\": {\r\n          \"self\": \"http://<server_name>/jsonapitest/api/process1/activity-models/activity2\"\r\n        }\r\n      },\r\n      {\r\n        \"type\": \"activity-models\",\r\n        \"id\": \"activity3\",\r\n        \"attributes\": {\r\n          \"activity-id\": 3,\r\n          \"activity-name\": \"Activity 3\",\r\n          \"activity-desc\": \"This is Activity 3 of Process 1\",\r\n          \"activity-route-name\": \"activity3\"\r\n        },\r\n        \"links\": {\r\n          \"self\": \"http://<server_name>/jsonapitest/api/process1/activity-models/activity3\"\r\n        }\r\n      }\r\n    ]\r\n  }\r\n}\r\n\r\n"}}
{"actor":{"display_login":"vinaysharma77"}}