{"action":"created","issue":{"url":"https://api.github.com/repos/opf/openproject/issues/3338","labels_url":"https://api.github.com/repos/opf/openproject/issues/3338/labels{/name}","comments_url":"https://api.github.com/repos/opf/openproject/issues/3338/comments","events_url":"https://api.github.com/repos/opf/openproject/issues/3338/events","html_url":"https://github.com/opf/openproject/pull/3338","id":100271021,"number":3338,"title":"Migrate parts of experimental API into APIv3","user":{"login":"NobodysNightmare","id":453584,"avatar_url":"https://avatars.githubusercontent.com/u/453584?v=3","gravatar_id":"","url":"https://api.github.com/users/NobodysNightmare","html_url":"https://github.com/NobodysNightmare","followers_url":"https://api.github.com/users/NobodysNightmare/followers","following_url":"https://api.github.com/users/NobodysNightmare/following{/other_user}","gists_url":"https://api.github.com/users/NobodysNightmare/gists{/gist_id}","starred_url":"https://api.github.com/users/NobodysNightmare/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NobodysNightmare/subscriptions","organizations_url":"https://api.github.com/users/NobodysNightmare/orgs","repos_url":"https://api.github.com/users/NobodysNightmare/repos","events_url":"https://api.github.com/users/NobodysNightmare/events{/privacy}","received_events_url":"https://api.github.com/users/NobodysNightmare/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/opf/openproject/labels/feature","name":"feature","color":"fbca04"},{"url":"https://api.github.com/repos/opf/openproject/labels/Needs%20Review","name":"Needs Review","color":"f7c6c7"},{"url":"https://api.github.com/repos/opf/openproject/labels/work%20in%20progress","name":"work in progress","color":"eb6420"}],"state":"open","locked":false,"assignee":{"login":"oliverguenther","id":459462,"avatar_url":"https://avatars.githubusercontent.com/u/459462?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverguenther","html_url":"https://github.com/oliverguenther","followers_url":"https://api.github.com/users/oliverguenther/followers","following_url":"https://api.github.com/users/oliverguenther/following{/other_user}","gists_url":"https://api.github.com/users/oliverguenther/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverguenther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverguenther/subscriptions","organizations_url":"https://api.github.com/users/oliverguenther/orgs","repos_url":"https://api.github.com/users/oliverguenther/repos","events_url":"https://api.github.com/users/oliverguenther/events{/privacy}","received_events_url":"https://api.github.com/users/oliverguenther/received_events","type":"User","site_admin":false},"milestone":null,"comments":15,"created_at":"2015-08-11T09:41:35Z","updated_at":"2015-08-27T12:05:12Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/opf/openproject/pulls/3338","html_url":"https://github.com/opf/openproject/pull/3338","diff_url":"https://github.com/opf/openproject/pull/3338.diff","patch_url":"https://github.com/opf/openproject/pull/3338.patch"},"body":"## OpenProject work package\r\n\r\nhttps://community.openproject.org/work_packages/18491\r\n\r\n## Description\r\n\r\nThis PR aims at providing everything that is needed to render the [WP list](https://community.openproject.org/projects/openproject/work_packages) in APIv3. The WP list is currently mainly built from the experimental API, a very specific API just intended for consumption by the WP list.\r\n\r\nAPIv3 has a broader audience (it should be a general purpose API), but is not yet able to serve all functions required to render the WP list.\r\n\r\nFunctionality provided in experimental API (and *apparently* consumed in WP list) includes:\r\n\r\n* [x] work package sorting (collection filters/options)\r\n* [x] work package filtering (collection filters)\r\n* [x] work package grouping (collection aggregation)\r\n    * [x] `valueLink`\r\n* [x] building sums (collection aggregation)\r\n    * [x] TODO: correct sums for durations\r\n* [x] TODO: move sums and groups out of `_embedded` zone\r\n* [x] TODO: validate user inputs above\r\n    * [x] error handling\r\n* [x] non project-scoped work package access\r\n* [ ] column meta information (schema)\r\n    * [x] endpoint for project-wise WP schema (free of type information)\r\n    * [x] exclude `lockVersion` column\r\n    * [ ] ~~include groupability information~~\r\n* [x] values of settings (configuration)\r\n    * [x] page-size steps aka `per_page_options`\r\n* [ ] ~~available export formats, e.g. Feeds, PDF, etc (???)~~\r\n* [x] TODO: convert field names (see caveats below)\r\n* [x] TODO: adapt plugins (e.g. WP schema)\r\n\r\nWhere possible I entered existing concepts of APIv3 in parenthesis, that may be able to fullfill the purpose (by being extended)...\r\n\r\nI still need to check which of those things are actually needed by the client, because there seems to be a lot of redundancy...\r\nAPIv3 does also not yet have concepts for all of the functionality provided (e.g. aggregation)...\r\n\r\n## Caveats\r\n\r\nFor the parameters `groupBy`, `sortBy` and `filters` I decided to accept the same formats as returned by the query representer (this would also be my goal with a QL, just that the representer would return the QL, rather than a custom JSON format). ~~However, since the query representer returns colum names as they are refered to internally to OpenProject, this does not always match up with the property names you would expect from the APIv3. Examples:~~\r\n\r\n* ~~`assignee` vs `assigned_to`~~\r\n* ~~`estimatedTime` vs `estimated_hours`~~\r\n\r\n~~I really would like to accept \"API names\" here, but I fear this is out of scope of this PR. I therefore decided to accept internally used active record names rather than \"API names\" for those parameters, because this is whats stored and returned in our queries and also whats consumed by the downstream code, used to actually perform the filtering/grouping.~~ edit: I actually included the name conversion in this PR, as inconsistent names would probably have lead to an unusable API, because the client will also seed the names of new columns etc from the API.\r\n\r\nAll other results from the API (including sums etc) should use the property names known from the API.\r\n\r\n## relevant Plugin-PRs\r\n\r\n* https://github.com/finnlabs/openproject-backlogs/issues/158\r\n* https://github.com/finnlabs/openproject-costs/issues/160"},"comment":{"url":"https://api.github.com/repos/opf/openproject/issues/comments/135402159","html_url":"https://github.com/opf/openproject/pull/3338#issuecomment-135402159","issue_url":"https://api.github.com/repos/opf/openproject/issues/3338","id":135402159,"user":{"login":"oliverguenther","id":459462,"avatar_url":"https://avatars.githubusercontent.com/u/459462?v=3","gravatar_id":"","url":"https://api.github.com/users/oliverguenther","html_url":"https://github.com/oliverguenther","followers_url":"https://api.github.com/users/oliverguenther/followers","following_url":"https://api.github.com/users/oliverguenther/following{/other_user}","gists_url":"https://api.github.com/users/oliverguenther/gists{/gist_id}","starred_url":"https://api.github.com/users/oliverguenther/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oliverguenther/subscriptions","organizations_url":"https://api.github.com/users/oliverguenther/orgs","repos_url":"https://api.github.com/users/oliverguenther/repos","events_url":"https://api.github.com/users/oliverguenther/events{/privacy}","received_events_url":"https://api.github.com/users/oliverguenther/received_events","type":"User","site_admin":false},"created_at":"2015-08-27T12:05:12Z","updated_at":"2015-08-27T12:05:12Z","body":"I would agree to leaving it out of this PR.\r\n\r\nThere seems to be some caching issue. I've uploaded a gist with a full log for one query (limited to 10 items)\r\n\r\nhttps://gist.github.com/oliverguenther/9090251baee2c48f0438\r\n\r\n\r\nI've tested filters, groupBy and sortBy on both the global and per-project collection, that seems to work fine except for the aforementioned exception issues.\r\n\r\nI'm having difficulties in understanding aggregation queries. That is returned when combining `groupBy` and `showSums` and depends on whether the column of groupBy can be summarized?\r\n\r\nI can't seem to produce a query where `totalSums` isn't empty.. "}}