OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
specify query projections
ulferts80e4b5664542
diff --git a/docs/api/apiv3/components/examples/project_query_projection_schemas.yml b/docs/api/apiv3/components/examples/project_query_projection_schemas.ymlnew file mode 100644index 00000000000..fade615b5bb--- /dev/null+++ b/docs/api/apiv3/components/examples/project_query_projection_schemas.yml@@ -0,0 +1,23 @@+# Example: ProjectQueryProjectionSchemas+---+value:+ _links:+ self:+ href: "/api/v3/projects/45/queries/projection_schemas"+ total: 1+ count: 1+ _type: Collection+ _embedded:+ elements:+ _links:+ self:+ href: "/api/v3/queries/projection_schemas/table"+ _type: Schema+ columns:+ _links: {}+ hasDefault: true+ location: _links+ name: Columns+ required: false+ type: "[]QueryColumn"+ writable: truediff --git a/docs/api/apiv3/components/examples/queries.yml b/docs/api/apiv3/components/examples/queries.ymlnew file mode 100644index 00000000000..3daf25ce6f8--- /dev/null+++ b/docs/api/apiv3/components/examples/queries.yml@@ -0,0 +1,111 @@+# Example: QueriesModel+---+value:+ _links:+ self:+ href: "/api/v3/queries"+ total: 1+ count: 1+ _type: Collection+ _embedded:+ elements:+ - _type: Query+ id: 9+ name: fdsfdsfdsf+ createdAt: '2015-03-20T12:56:56Z'+ updatedAt: '2015-05-20T18:16:53Z'+ filters:+ - _type: StatusQueryFilter+ name: Status+ _links:+ filter:+ href: "/api/v3/queries/filters/status"+ title: Status+ operator:+ href: "/api/v3/queries/operators/o"+ title: open+ schema:+ href: "/api/v3/queries/filter_instance_schemas/status"+ values: []+ - _type: DueDateQueryFilter+ name: Finish date+ values:+ - '1'+ _links:+ filter:+ href: "/api/v3/queries/filters/dueDate"+ title: Finish date+ operator:+ href: "/api/v3/queries/operators/<t+"+ title: in less than+ schema:+ href: "/api/v3/queries/filter_instance_schemas/dueDate"+ public: false+ sums: false+ starred: true+ projections:+ - _type: QueryProjection::Table+ - _type: QueryProjection::TeamPlanner+ _links:+ rows:+ - href: "/api/v3/users/1"+ title: "Bob Bobbit"+ - _type: QueryProjection::Calendar+ _embedded:+ results:+ _type: WorkPackageCollection+ total: 234+ count: 30+ pageSize: 30+ offset: 1+ _embedded:+ elements:+ - "<--- shortened for brevity --->"+ _links:+ self:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ jumpTo:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ templated: true+ changeSize:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ templated: true+ createWorkPackage:+ href: "/api/v3/work_packages/form"+ method: post+ createWorkPackageImmediate:+ href: "/api/v3/work_packages"+ method: post+ _links:+ self:+ href: "/api/v3/queries/9"+ title: fdsfdsfdsf+ results:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ columns:+ - href: "/api/v3/queries/columns/id"+ title: ID+ - href: "/api/v3/queries/columns/subject"+ title: Subject+ - href: "/api/v3/queries/columns/type"+ title: Type+ - href: "/api/v3/queries/columns/status"+ title: Status+ - href: "/api/v3/queries/columns/priority"+ title: Priority+ - href: "/api/v3/queries/columns/assignee"+ title: Assignee+ - href: "/api/v3/queries/columns/updated_at"+ title: Updated on+ groupBy:+ href:+ title:+ sortBy:+ - href: "/api/v3/queries/sort_bys/parent-desc"+ title: Parent (Descending)+ user:+ href: "/api/v3/users/1"+ title: OpenProject Admin+ project:+ href: "/api/v3/projects/3"+ title: copydiff --git a/docs/api/apiv3/components/examples/query.yml b/docs/api/apiv3/components/examples/query.ymlnew file mode 100644index 00000000000..8cf3640a501--- /dev/null+++ b/docs/api/apiv3/components/examples/query.yml@@ -0,0 +1,113 @@+# Example: QueryModel+---+value:+ _type: Query+ id: 9+ name: abcdefg+ createdAt: '2015-03-20T12:56:56Z'+ updatedAt: '2015-05-20T18:16:53Z'+ filters:+ - _type: StatusQueryFilter+ name: Status+ _links:+ filter:+ href: "/api/v3/queries/filters/status"+ title: Status+ operator:+ href: "/api/v3/queries/operators/o"+ title: open+ schema:+ href: "/api/v3/queries/filter_instance_schemas/status"+ values: []+ - _type: DueDateQueryFilter+ name: Finish date+ values:+ - '1'+ _links:+ filter:+ href: "/api/v3/queries/filters/dueDate"+ title: Finish date+ operator:+ href: "/api/v3/queries/operators/<t+"+ title: in less than+ schema:+ href: "/api/v3/queries/filter_instance_schemas/dueDate"+ public: false+ sums: false+ starred: false+ projections:+ - _type: QueryProjection::Table+ showHierarchies: true+ _links:+ columns:+ - href: "/api/v3/queries/columns/id"+ title: ID+ - href: "/api/v3/queries/columns/subject"+ title: Subject+ - href: "/api/v3/queries/columns/type"+ title: Type+ - href: "/api/v3/queries/columns/status"+ title: Status+ - href: "/api/v3/queries/columns/priority"+ title: Priority+ - href: "/api/v3/queries/columns/assignee"+ title: Assignee+ - href: "/api/v3/queries/columns/updated_at"+ title: Updated on+ highlightedAttributes: []+ - _type: QueryProjection::Gantt+ labels: {}+ zoomLevel: "auto"+ _links:+ highlightedAttributes: []+ - _type: QueryProjection::TeamPlanner+ _links:+ rows:+ - href: "/api/v3/users/1"+ title: "Alan Touring"+ - href: "/api/v3/users/5"+ title: "John von Neumann"+ - _type: QueryProjection::Calendar+ _embedded:+ results:+ _type: WorkPackageCollection+ total: 234+ count: 30+ pageSize: 30+ offset: 1+ _embedded:+ elements:+ - "<--- shortened for brevity --->"+ _links:+ self:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ jumpTo:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ templated: true+ changeSize:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ templated: true+ createWorkPackage:+ href: "/api/v3/work_packages/form"+ method: post+ createWorkPackageImmediate:+ href: "/api/v3/work_packages"+ method: post+ _links:+ self:+ href: "/api/v3/queries/9"+ title: abcdefg+ results:+ href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"+ groupBy:+ href:+ title:+ sortBy:+ - href: "/api/v3/queries/sort_bys/parent-desc"+ title: Parent (Descending)+ user:+ href: "/api/v3/users/1"+ title: OpenProject Admin+ project:+ href: "/api/v3/projects/3"+ title: copydiff --git a/docs/api/apiv3/components/examples/query_projection_schemas.yml b/docs/api/apiv3/components/examples/query_projection_schemas.ymlnew file mode 100644index 00000000000..c88617ae584--- /dev/null+++ b/docs/api/apiv3/components/examples/query_projection_schemas.yml@@ -0,0 +1,23 @@+# Example: QueryProjectionSchemas+---+value:+ _links:+ self:+ href: "/api/v3/queries/projection_schemas"+ total: 1+ count: 1+ _type: Collection+ _embedded:+ elements:+ _links:+ self:+ href: "/api/v3/queries/projection_schemas/table"+ _type: Schema+ columns:+ _links: {}+ hasDefault: true+ location: _links+ name: Columns+ required: false+ type: "[]QueryColumn"+ writable: truediff --git a/docs/api/apiv3/components/examples/query_projection_table_schema.yml b/docs/api/apiv3/components/examples/query_projection_table_schema.ymlnew file mode 100644index 00000000000..6d086d675aa--- /dev/null+++ b/docs/api/apiv3/components/examples/query_projection_table_schema.yml@@ -0,0 +1,17 @@+# Example: QueryProjection::TableSchema+---+value:+ _dependencies: []+ _embedded:+ _links:+ self:+ href: "/api/v3/queries/projection_schemas/table"+ _type: Schema+ columns:+ _links: {}+ hasDefault: true+ location: _links+ name: Columns+ required: false+ type: "[]QueryColumn"+ writable: truediff --git a/docs/api/apiv3/components/examples/query_schema.yml b/docs/api/apiv3/components/examples/query_schema.ymlnew file mode 100644index 00000000000..3e27b1f467d--- /dev/null+++ b/docs/api/apiv3/components/examples/query_schema.yml@@ -0,0 +1,242 @@+# Example: QuerySchemaModel+---+value:+ _dependencies: []+ _embedded:+ filtersSchemas:+ _embedded:+ elements:+ - _dependencies:+ - _type: SchemaDependency+ dependencies:+ "/api/v3/queries/operators/!":+ values:+ _links: {}+ hasDefault: false+ name: Values+ required: true+ type: "[]User"+ writable: true+ "/api/v3/queries/operators/!*": {}+ "/api/v3/queries/operators/*": {}+ "/api/v3/queries/operators/=":+ values:+ _links: {}+ hasDefault: false+ name: Values+ required: true+ type: "[]User"+ writable: true+ 'on': operator+ _links:+ filter:+ href: "/api/v3/queries/filters/assignee"+ title: Assignee+ self:+ href: "/api/v3/queries/filter_instance_schemas/assignee"+ _type: QueryFilterInstanceSchema+ filter:+ _links: {}+ hasDefault: false+ name: Filter+ required: true+ type: QueryFilter+ writable: true+ name:+ hasDefault: true+ name: Name+ required: true+ type: String+ writable: false+ - _dependencies:+ - _type: SchemaDependency+ dependencies:+ "/api/v3/queries/operators/!":+ values:+ _links: {}+ hasDefault: false+ name: Values+ required: true+ type: "[]User"+ writable: true+ "/api/v3/queries/operators/=":+ values:+ _links: {}+ hasDefault: false+ name: Values+ required: true+ type: "[]User"+ writable: true+ 'on': operator+ _links:+ filter:+ href: "/api/v3/queries/filters/author"+ title: Author+ self:+ href: "/api/v3/queries/filter_instance_schemas/author"+ _type: QueryFilterInstanceSchema+ filter:+ _links: {}+ hasDefault: false+ name: Filter+ required: true+ type: QueryFilter+ writable: true+ name:+ hasDefault: true+ name: Name+ required: true+ type: String+ writable: false+ _links:+ self:+ href: "/api/v3/queries/filter_instance_schemas"+ _type: Collection+ count: 20+ total: 20+ _links:+ self:+ href: "/api/v3/queries/schema"+ _type: Schema+ columns:+ _links: {}+ hasDefault: true+ location: _links+ name: Columns+ required: false+ type: "[]QueryColumn"+ writable: true+ createdAt:+ hasDefault: false+ name: Created on+ required: true+ type: DateTime+ writable: false+ filters:+ _links:+ allowedValuesSchemas:+ href: "/api/v3/queries/filter_instance_schemas"+ hasDefault: true+ location: _links+ name: Filters+ required: false+ type: "[]QueryFilterInstance"+ writable: true+ groupBy:+ _links: {}+ hasDefault: false+ name: Group results by+ required: false+ type: "[]QueryGroupBy"+ writable: true+ highlightedAttributes:+ hasDefault: true+ location: _links+ name: Highlighted attributes+ required: false+ type: "[]QueryColumn"+ writable: true+ highlightingMode:+ hasDefault: true+ name: Highlighting mode+ required: false+ type: String+ writable: true+ id:+ hasDefault: false+ name: ID+ required: true+ type: Integer+ writable: false+ name:+ hasDefault: false+ maxLength: 255+ minLength: 1+ name: Name+ required: true+ type: String+ writable: true+ project:+ _links: {}+ hasDefault: false+ location: _links+ name: Project+ required: false+ type: Project+ writable: true+ public:+ hasDefault: true+ name: Public+ required: false+ type: Boolean+ writable: true+ projections:+ _links:+ allowedValuesSchemas:+ href: "/api/v3/queries/projections_schemas"+ hasDefault: true+ name: Projections+ required: false+ type: "[]QueryProjection"+ writable: true+ results:+ hasDefault: false+ name: Results+ required: false+ type: WorkPackageCollection+ writable: false+ showHierarchies:+ hasDefault: true+ name: Show hierarchies+ required: false+ type: Boolean+ writable: true+ sortBy:+ _links: {}+ hasDefault: true+ name: Sort by+ required: false+ type: "[]QuerySortBy"+ writable: true+ starred:+ hasDefault: true+ name: Starred+ required: false+ type: Boolean+ writable: true+ sums:+ hasDefault: true+ name: Sums+ required: false+ type: Boolean+ writable: true+ timelineLabels:+ hasDefault: true+ name: Timeline labels+ required: false+ type: QueryTimelineLabels+ writable: true+ timelineVisible:+ hasDefault: true+ name: Timeline visible+ required: false+ type: Boolean+ writable: true+ timelineZoomLevel:+ hasDefault: true+ name: Timeline zoom level+ required: false+ type: String+ writable: true+ updatedAt:+ hasDefault: false+ name: Updated on+ required: true+ type: DateTime+ writable: false+ user:+ hasDefault: true+ name: User+ required: true+ type: User+ writable: falsediff --git a/docs/api/apiv3/components/schemas/queries_model.yml b/docs/api/apiv3/components/schemas/queries_model.ymlindex 4888917b0eb..b28c2904446 100644--- a/docs/api/apiv3/components/schemas/queries_model.yml+++ b/docs/api/apiv3/components/schemas/queries_model.yml@@ -44,12 +44,20 @@ example:public: falsesums: falsestarred: true+ projections:+ - _type: Query::TableProjection+ - _type: Query::TeamPlannerProjection+ _links:+ rows:+ - href: "/api/v3/users/1"+ title: "Bob Bobbit"+ - _type: Query::CalendarProjection_embedded:results:_type: WorkPackageCollectiontotal: 234count: 30- pageSize: 2+ pageSize: 30offset: 1_embedded:elements:diff --git a/docs/api/apiv3/components/schemas/query_model.yml b/docs/api/apiv3/components/schemas/query_model.ymlindex fd548fde221..ba3809d06e8 100644--- a/docs/api/apiv3/components/schemas/query_model.yml+++ b/docs/api/apiv3/components/schemas/query_model.yml@@ -16,10 +16,10 @@ properties:description: Query namereadOnly: truefilters:- type: "[]queryfilterinstance"+ type: "[]QueryFilterInstance"description: A set of QueryFilters which will be applied to the work packagesto determine the resulting work packages- readOnly: true+ readOnly: falsesums:type: booleandescription: Should sums (of supported properties) be shown?@@ -29,7 +29,7 @@ properties:description: Should the timeline mode be shown?readOnly: truetimelineLabels:- type: querytimelinelabels+ type: QueryTimelineLabelsdescription: Which labels are shown in the timeline, empty when defaultreadOnly: truetimelineZoomLevel:@@ -66,6 +66,8 @@ properties:format: date-timedescription: Time of the most recent change to the queryreadOnly: true+ projections:+ type: "[]QueryProjection"_links:type: objectproperties:@@ -108,99 +110,4 @@ properties:# Conditions**Permission**: save queries for own queries, manage public queries for public queries;- readOnly: true-example:- _type: Query- id: 9- name: fdsfdsfdsf- createdAt: '2015-03-20T12:56:56Z'- updatedAt: '2015-05-20T18:16:53Z'- filters:- - _type: StatusQueryFilter- name: Status- _links:- filter:- href: "/api/v3/queries/filters/status"- title: Status- operator:- href: "/api/v3/queries/operators/o"- title: open- schema:- href: "/api/v3/queries/filter_instance_schemas/status"- values: []- - _type: DueDateQueryFilter- name: Finish date- values:- - '1'- _links:- filter:- href: "/api/v3/queries/filters/dueDate"- title: Finish date- operator:- href: "/api/v3/queries/operators/<t+"- title: in less than- schema:- href: "/api/v3/queries/filter_instance_schemas/dueDate"- public: false- sums: false- starred: false- _embedded:- results:- _type: WorkPackageCollection- total: 234- count: 30- pageSize: 2- offset: 1- _embedded:- elements:- - "<--- shortened for brevity --->"- _links:- self:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- jumpTo:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- changeSize:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- createWorkPackage:- href: "/api/v3/work_packages/form"- method: post- createWorkPackageImmediate:- href: "/api/v3/work_packages"- method: post- highlightedAttributes: []- _links:- self:- href: "/api/v3/queries/9"- title: fdsfdsfdsf- results:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- columns:- - href: "/api/v3/queries/columns/id"- title: ID- - href: "/api/v3/queries/columns/subject"- title: Subject- - href: "/api/v3/queries/columns/type"- title: Type- - href: "/api/v3/queries/columns/status"- title: Status- - href: "/api/v3/queries/columns/priority"- title: Priority- - href: "/api/v3/queries/columns/assignee"- title: Assignee- - href: "/api/v3/queries/columns/updated_at"- title: Updated on- highlightedAttributes: []- groupBy:- href:- title:- sortBy:- - href: "/api/v3/queries/sort_bys/parent-desc"- title: Parent (Descending)- user:- href: "/api/v3/users/1"- title: OpenProject Admin- project:- href: "/api/v3/projects/3"- title: copy+ readOnly: true\ No newline at end of filediff --git a/docs/api/apiv3/components/schemas/query_projection_schemas.yml b/docs/api/apiv3/components/schemas/query_projection_schemas.ymlnew file mode 100644index 00000000000..e69de29bb2ddiff --git a/docs/api/apiv3/openapi-spec.yml b/docs/api/apiv3/openapi-spec.ymlindex 21c082dfad7..9d088c11eee 100644--- a/docs/api/apiv3/openapi-spec.yml+++ b/docs/api/apiv3/openapi-spec.yml@@ -241,6 +241,8 @@ paths:"$ref": "./paths/project_queries_default.yml""/api/v3/projects/{id}/queries/filter_instance_schemas":"$ref": "./paths/project_queries_filter_instance_schemas.yml"+ "/api/v3/projects/{id}/queries/projection_schemas":+ "$ref": "./paths/project_queries_projection_schemas.yml""/api/v3/projects/{id}/queries/schema":"$ref": "./paths/project_queries_schema.yml""/api/v3/projects/{id}/work_packages":@@ -275,6 +277,10 @@ paths:"$ref": "./paths/queries_form.yml""/api/v3/queries/operators/{id}":"$ref": "./paths/queries_operator.yml"+ "/api/v3/queries/projection_schemas":+ "$ref": "./paths/queries_projection_schemas.yml"+ "/api/v3/queries/projection_schemas/table":+ "$ref": "./paths/queries_projection_table_schema.yml""/api/v3/queries/schema":"$ref": "./paths/queries_schema.yml""/api/v3/queries/sort_bys/{id}":@@ -386,6 +392,19 @@ paths:"/api/v3/work_packages/{id}/watchers/{user_id}":"$ref": "./paths/work_package_watcher.yml"components:+ examples:+ ProjectQueryProjectionSchemas:+ "$ref": "./components/examples/project_query_projection_schemas.yml"+ QueriesModel:+ "$ref": "./components/examples/queries.yml"+ QueryModel:+ "$ref": "./components/examples/query.yml"+ QueryProjectionSchemas:+ "$ref": "./components/examples/query_projection_schemas.yml"+ QueryProjectionTableSchema:+ "$ref": "./components/examples/query_projection_table_schema.yml"+ QuerySchemaModel:+ "$ref": "./components/examples/query_schema.yml"schemas:ActivityModel:"$ref": "./components/schemas/activity_model.yml"@@ -583,6 +602,8 @@ components:"$ref": "./components/schemas/query_filter_instance_schemas_model.yml"Query_Filter_Instance_Schemas_For_ProjectModel:"$ref": "./components/schemas/query_filter_instance_schemas_for_project_model.yml"+ QueryProjectionSchemas:+ "$ref": "./components/schemas/query_projection_schemas.yml"Query_OperatorModel:"$ref": "./components/schemas/query_operator_model.yml"Query_Sort_ByModel:@@ -755,6 +776,7 @@ tags:- "$ref": "./tags/query_operators.yml"- "$ref": "./tags/query_sort_bys.yml"- "$ref": "./tags/query_filter_instance_schema.yml"+- "$ref": "./tags/query_projection_schema.yml"- "$ref": "./tags/relations.yml"- "$ref": "./tags/previewing.yml"- "$ref": "./tags/revisions.yml"diff --git a/docs/api/apiv3/paths/project_queries_projection_schemas.yml b/docs/api/apiv3/paths/project_queries_projection_schemas.ymlnew file mode 100644index 00000000000..02afeaba93e--- /dev/null+++ b/docs/api/apiv3/paths/project_queries_projection_schemas.yml@@ -0,0 +1,33 @@+# /api/v3/projects/{id}/queries/projection_schemas+---+get:+ responses:+ '200':+ content:+ application/hal+json:+ examples:+ QueryProjectionSchemas:+ "$ref": "../components/examples/query_projection_schemas.yml"+ description: OK+ headers: {}+ '403':+ content:+ application/hal+json:+ examples:+ response:+ value:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:Unauthenticated+ message: You are not authorized to access this resource.+ description: |-+ Returned if the client does not have sufficient permissions to see it.++ **Required permission:** view work package in any project+ headers: {}+ tags:+ - Query Projection Schema+ description: Returns the list of QueryProjection schemas defined for the project the+ query is in. Depending on the modules active in the project and the permissions the calling user+ has, this list might differn betweeen projects and users.+ operationId: List_Project_Query_Projection_Schemas+ summary: List Project Query Projection Schemasdiff --git a/docs/api/apiv3/paths/project_queries_schema.yml b/docs/api/apiv3/paths/project_queries_schema.ymlindex 245d458c622..d2129dd4864 100644--- a/docs/api/apiv3/paths/project_queries_schema.yml+++ b/docs/api/apiv3/paths/project_queries_schema.yml@@ -14,216 +14,8 @@ get:content:application/hal+json:examples:- response:- value:- _dependencies: []- _embedded:- filtersSchemas:- _embedded:- elements:- - _dependencies:- - _type: SchemaDependency- dependencies:- "/api/v3/queries/operators/!":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- "/api/v3/queries/operators/!*": {}- "/api/v3/queries/operators/*": {}- "/api/v3/queries/operators/=":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- 'on': operator- _links:- filter:- href: "/api/v3/queries/filters/assignee"- title: Assignee- self:- href: "/api/v3/queries/filter_instance_schemas/assignee"- _type: QueryFilterInstanceSchema- filter:- _links: {}- hasDefault: false- name: Filter- required: true- type: QueryFilter- writable: true- name:- hasDefault: true- name: Name- required: true- type: String- writable: false- - _dependencies:- - _type: SchemaDependency- dependencies:- "/api/v3/queries/operators/!":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- "/api/v3/queries/operators/=":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- 'on': operator- _links:- filter:- href: "/api/v3/queries/filters/author"- title: Author- self:- href: "/api/v3/queries/filter_instance_schemas/author"- _type: QueryFilterInstanceSchema- filter:- _links: {}- hasDefault: false- name: Filter- required: true- type: QueryFilter- writable: true- name:- hasDefault: true- name: Name- required: true- type: String- writable: false- _links:- self:- href: "/api/v3/projects/42/queries/filter_instance_schemas"- _type: Collection- count: 20- total: 20- _links:- self:- href: "/api/v3/projects/42/queries/schema"- _type: Schema- columns:- _links: {}- hasDefault: true- name: Columns- required: false- type: "[]QueryColumn"- writable: true- createdAt:- hasDefault: false- name: Created on- required: true- type: DateTime- writable: false- filters:- _links:- allowedValuesSchemas:- href: "/api/v3/projects/42/queries/filter_instance_schemas"- hasDefault: true- name: Filters- required: false- type: "[]QueryFilterInstance"- writable: true- groupBy:- _links: {}- hasDefault: false- name: Group results by- required: false- type: "[]QueryGroupBy"- writable: true- id:- hasDefault: false- name: ID- required: true- type: Integer- writable: false- name:- hasDefault: false- maxLength: 255- minLength: 1- name: Name- required: true- type: String- writable: true- project:- _links: {}- hasDefault: false- name: Project- required: false- type: Project- writable: true- public:- hasDefault: true- name: Public- required: false- type: Boolean- writable: true- results:- hasDefault: false- name: Results- required: false- type: WorkPackageCollection- writable: false- showHierarchies:- hasDefault: true- name: Show hierarchies- required: false- type: Boolean- writable: true- sortBy:- _links: {}- hasDefault: true- name: Sort by- required: false- type: "[]QuerySortBy"- writable: true- starred:- hasDefault: true- name: Starred- required: false- type: Boolean- writable: true- sums:- hasDefault: true- name: Sums- required: false- type: Boolean- writable: true- timelineVisible:- hasDefault: true- name: Timeline visible- required: false- type: Boolean- writable: true- timelineZoomLevel:- hasDefault: true- name: Timeline zoom level- required: false- type: String- writable: true- updatedAt:- hasDefault: false- name: Updated on- required: true- type: DateTime- writable: false- user:- hasDefault: true- name: User- required: true- type: User- writable: false+ QuerySchema:+ "$ref": "../components/examples/query_schema.yml"schema:"$ref": "../components/schemas/schema_for_project_queries_model.yml"description: OKdiff --git a/docs/api/apiv3/paths/queries.yml b/docs/api/apiv3/paths/queries.ymlindex 2ea35a87ccd..9defe4922f6 100644--- a/docs/api/apiv3/paths/queries.yml+++ b/docs/api/apiv3/paths/queries.yml@@ -22,108 +22,8 @@ get:content:application/hal+json:examples:- response:- value:- _embedded:- elements:- - _embedded:- results:- _embedded:- elements:- - "<--- shortened for brevity --->"- _links:- changeSize:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- createWorkPackage:- href: "/api/v3/work_packages/form"- method: post- createWorkPackageImmediate:- href: "/api/v3/work_packages"- method: post- jumpTo:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- self:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- _type: WorkPackageCollection- count: 30- offset: 1- pageSize: 2- total: 234- _links:- columns:- - href: "/api/v3/queries/columns/id"- title: ID- - href: "/api/v3/queries/columns/subject"- title: Subject- - href: "/api/v3/queries/columns/type"- title: Type- - href: "/api/v3/queries/columns/status"- title: Status- - href: "/api/v3/queries/columns/priority"- title: Priority- - href: "/api/v3/queries/columns/assignee"- title: Assignee- - href: "/api/v3/queries/columns/updated_at"- title: Updated on- groupBy:- href:- title:- project:- href: "/api/v3/projects/3"- title: copy- results:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- self:- href: "/api/v3/queries/9"- title: fdsfdsfdsf- sortBy:- - href: "/api/v3/queries/sort_bys/parent-desc"- title: Parent (Descending)- user:- href: "/api/v3/users/1"- title: OpenProject Admin- _type: Query- createdAt: '2015-03-20T12:56:56Z'- filters:- - _links:- filter:- href: "/api/v3/queries/filters/status"- title: Status- operator:- href: "/api/v3/queries/operators/o"- title: open- schema:- href: "/api/v3/queries/filter_instance_schemas/status"- values: []- _type: StatusQueryFilter- name: Status- - _links:- filter:- href: "/api/v3/queries/filters/dueDate"- title: Finish date- operator:- href: "/api/v3/queries/operators/<t+"- title: in less than- schema:- href: "/api/v3/queries/filter_instance_schemas/dueDate"- _type: DueDateQueryFilter- name: Finish date- values:- - '1'- id: 9- name: fdsfdsfdsf- public: false- starred: true- sums: false- updatedAt: '2015-05-20T18:16:53Z'- _links:- self:- href: "/api/v3/queries"- _type: Collection- count: 1- total: 1+ Queries:+ "$ref": "../components/examples/queries.yml"schema:"$ref": "../components/schemas/queries_model.yml"description: OK@@ -156,102 +56,8 @@ post:content:application/hal+json:examples:- response:- value:- _embedded:- highlightedAttributes: []- results:- _embedded:- elements:- - "<--- shortened for brevity --->"- _links:- changeSize:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- createWorkPackage:- href: "/api/v3/work_packages/form"- method: post- createWorkPackageImmediate:- href: "/api/v3/work_packages"- method: post- jumpTo:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- self:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- _type: WorkPackageCollection- count: 30- offset: 1- pageSize: 2- total: 234- _links:- columns:- - href: "/api/v3/queries/columns/id"- title: ID- - href: "/api/v3/queries/columns/subject"- title: Subject- - href: "/api/v3/queries/columns/type"- title: Type- - href: "/api/v3/queries/columns/status"- title: Status- - href: "/api/v3/queries/columns/priority"- title: Priority- - href: "/api/v3/queries/columns/assignee"- title: Assignee- - href: "/api/v3/queries/columns/updated_at"- title: Updated on- groupBy:- href:- title:- highlightedAttributes: []- project:- href: "/api/v3/projects/3"- title: copy- results:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- self:- href: "/api/v3/queries/9"- title: fdsfdsfdsf- sortBy:- - href: "/api/v3/queries/sort_bys/parent-desc"- title: Parent (Descending)- user:- href: "/api/v3/users/1"- title: OpenProject Admin- _type: Query- createdAt: '2015-03-20T12:56:56Z'- filters:- - _links:- filter:- href: "/api/v3/queries/filters/status"- title: Status- operator:- href: "/api/v3/queries/operators/o"- title: open- schema:- href: "/api/v3/queries/filter_instance_schemas/status"- values: []- _type: StatusQueryFilter- name: Status- - _links:- filter:- href: "/api/v3/queries/filters/dueDate"- title: Finish date- operator:- href: "/api/v3/queries/operators/<t+"- title: in less than- schema:- href: "/api/v3/queries/filter_instance_schemas/dueDate"- _type: DueDateQueryFilter- name: Finish date- values:- - '1'- id: 9- name: fdsfdsfdsf- public: false- starred: false- sums: false- updatedAt: '2015-05-20T18:16:53Z'+ Query:+ "$ref": "../components/examples/query.yml"schema:"$ref": "../components/schemas/query_model.yml"description: Createddiff --git a/docs/api/apiv3/paths/queries_default.yml b/docs/api/apiv3/paths/queries_default.ymlindex f65b36996f1..ac430fefb74 100644--- a/docs/api/apiv3/paths/queries_default.yml+++ b/docs/api/apiv3/paths/queries_default.yml@@ -112,7 +112,6 @@ get:href: "/api/v3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"_type: WorkPackageCollectioncount: 30- highlightedAttributes: []offset: 1pageSize: 2total: 234diff --git a/docs/api/apiv3/paths/queries_projection_schemas.yml b/docs/api/apiv3/paths/queries_projection_schemas.ymlnew file mode 100644index 00000000000..0b7a008f466--- /dev/null+++ b/docs/api/apiv3/paths/queries_projection_schemas.yml@@ -0,0 +1,32 @@+# /api/v3/queries/projection_schemas+---+get:+ responses:+ '200':+ content:+ application/hal+json:+ examples:+ ProjectQueryProjectionSchemas:+ "$ref": "../components/examples/project_query_projection_schemas.yml"+ description: OK+ headers: {}+ '403':+ content:+ application/hal+json:+ examples:+ response:+ value:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:Unauthenticated+ message: You are not authorized to access this resource.+ description: |-+ Returned if the client does not have sufficient permissions to see it.++ **Required permission:** view work package in any project+ headers: {}+ tags:+ - Query Projection Schema+ description: Returns the list of QueryProjection schemas defined for a global+ query, which is a query not assigned to a project.+ operationId: List_Query_Projection_Schemas+ summary: List Query Projection Schemasdiff --git a/docs/api/apiv3/paths/queries_projection_table_schema.yml b/docs/api/apiv3/paths/queries_projection_table_schema.ymlnew file mode 100644index 00000000000..fd4ed48a11c--- /dev/null+++ b/docs/api/apiv3/paths/queries_projection_table_schema.yml@@ -0,0 +1,31 @@+# /api/v3/queries/projection_schemas/table+---+get:+ responses:+ '200':+ content:+ application/hal+json:+ examples:+ QueryProjectionTableSchema:+ "$ref": "../components/examples/query_projection_table_schema.yml"+ description: OK+ headers: {}+ '403':+ content:+ application/hal+json:+ examples:+ response:+ value:+ _type: Error+ errorIdentifier: urn:openproject-org:api:v3:errors:Unauthenticated+ message: You are not authorized to access this resource.+ description: |-+ Returned if the client does not have sufficient permissions to see it.++ **Required permission:** view work package in any project+ headers: {}+ tags:+ - Query Projection Schema+ description: Returns the schema for a `QueryProjection::Table`.+ operationId: View_Query_Projection_Table_Schema+ summary: View 'QueryProjection::Table' Schemadiff --git a/docs/api/apiv3/paths/queries_schema.yml b/docs/api/apiv3/paths/queries_schema.ymlindex 66c6b5a5283..f67e0965431 100644--- a/docs/api/apiv3/paths/queries_schema.yml+++ b/docs/api/apiv3/paths/queries_schema.yml@@ -6,238 +6,8 @@ get:content:application/hal+json:examples:- response:- value:- _dependencies: []- _embedded:- filtersSchemas:- _embedded:- elements:- - _dependencies:- - _type: SchemaDependency- dependencies:- "/api/v3/queries/operators/!":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- "/api/v3/queries/operators/!*": {}- "/api/v3/queries/operators/*": {}- "/api/v3/queries/operators/=":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- 'on': operator- _links:- filter:- href: "/api/v3/queries/filters/assignee"- title: Assignee- self:- href: "/api/v3/queries/filter_instance_schemas/assignee"- _type: QueryFilterInstanceSchema- filter:- _links: {}- hasDefault: false- name: Filter- required: true- type: QueryFilter- writable: true- name:- hasDefault: true- name: Name- required: true- type: String- writable: false- - _dependencies:- - _type: SchemaDependency- dependencies:- "/api/v3/queries/operators/!":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- "/api/v3/queries/operators/=":- values:- _links: {}- hasDefault: false- name: Values- required: true- type: "[]User"- writable: true- 'on': operator- _links:- filter:- href: "/api/v3/queries/filters/author"- title: Author- self:- href: "/api/v3/queries/filter_instance_schemas/author"- _type: QueryFilterInstanceSchema- filter:- _links: {}- hasDefault: false- name: Filter- required: true- type: QueryFilter- writable: true- name:- hasDefault: true- name: Name- required: true- type: String- writable: false- _links:- self:- href: "/api/v3/queries/filter_instance_schemas"- _type: Collection- count: 20- total: 20- _links:- self:- href: "/api/v3/queries/schema"- _type: Schema- columns:- _links: {}- hasDefault: true- location: _links- name: Columns- required: false- type: "[]QueryColumn"- writable: true- createdAt:- hasDefault: false- name: Created on- required: true- type: DateTime- writable: false- filters:- _links:- allowedValuesSchemas:- href: "/api/v3/queries/filter_instance_schemas"- hasDefault: true- location: _links- name: Filters- required: false- type: "[]QueryFilterInstance"- writable: true- groupBy:- _links: {}- hasDefault: false- name: Group results by- required: false- type: "[]QueryGroupBy"- writable: true- highlightedAttributes:- hasDefault: true- location: _links- name: Highlighted attributes- required: false- type: "[]QueryColumn"- writable: true- highlightingMode:- hasDefault: true- name: Highlighting mode- required: false- type: String- writable: true- id:- hasDefault: false- name: ID- required: true- type: Integer- writable: false- name:- hasDefault: false- maxLength: 255- minLength: 1- name: Name- required: true- type: String- writable: true- project:- _links: {}- hasDefault: false- location: _links- name: Project- required: false- type: Project- writable: true- public:- hasDefault: true- name: Public- required: false- type: Boolean- writable: true- results:- hasDefault: false- name: Results- required: false- type: WorkPackageCollection- writable: false- showHierarchies:- hasDefault: true- name: Show hierarchies- required: false- type: Boolean- writable: true- sortBy:- _links: {}- hasDefault: true- name: Sort by- required: false- type: "[]QuerySortBy"- writable: true- starred:- hasDefault: true- name: Starred- required: false- type: Boolean- writable: true- sums:- hasDefault: true- name: Sums- required: false- type: Boolean- writable: true- timelineLabels:- hasDefault: true- name: Timeline labels- required: false- type: QueryTimelineLabels- writable: true- timelineVisible:- hasDefault: true- name: Timeline visible- required: false- type: Boolean- writable: true- timelineZoomLevel:- hasDefault: true- name: Timeline zoom level- required: false- type: String- writable: true- updatedAt:- hasDefault: false- name: Updated on- required: true- type: DateTime- writable: false- user:- hasDefault: true- name: User- required: true- type: User- writable: false+ QuerySchema:+ "$ref": "../components/examples/query_schema.yml"schema:"$ref": "../components/schemas/schema_for_global_queries_model.yml"description: OKdiff --git a/docs/api/apiv3/paths/query.yml b/docs/api/apiv3/paths/query.ymlindex 92c51678fe4..8b14a8dbdf9 100644--- a/docs/api/apiv3/paths/query.yml+++ b/docs/api/apiv3/paths/query.yml@@ -52,220 +52,126 @@ delete:summary: Delete queryget:parameters:- - description: Query id- example: '1'- in: path- name: id- required: true- schema:- type: integer- - description: |-- JSON specifying filter conditions.- The filters provided as parameters are not applied to the query but are instead used to override the query's persisted filters.- All filters also accepted by the work packages endpoint are accepted. If no filter is to be applied, the client should send an empty array (`[]`).- example: '[{ "assignee": { "operator": "=", "values": ["1", "5"] }" }]'- in: query- name: filters- required: false- schema:- default: '[{ "status_id": { "operator": "o", "values": null }}]'- type: string- - description: Page number inside the queries' result collection of work packages.- example: '25'- in: query- name: offset- required: false- schema:- default: 1- type: integer- - description: Number of elements to display per page for the queries' result collection- of work packages.- example: '25'- in: query- name: pageSize- required: false- schema:- type: integer- - description: Selected columns for the table view.- example: "[]"- in: query- name: columns- required: false- schema:- default: "['type', 'priority']"- type: string- - description: JSON specifying sort criteria. The sort criteria is applied to the- query's result collection of work packages overriding the query's persisted- sort criteria.- example: '[["status", "asc"]]'- in: query- name: sortBy- required: false- schema:- default: '[["id", "asc"]]'- type: string- - description: The column to group by. The grouping criteria is applied to the to- the query's result collection of work packages overriding the query's persisted- group criteria.- example: status- in: query- name: groupBy- required: false- schema:- type: string- - description: Indicates whether properties should be summed up if they support- it. The showSums parameter is applied to the to the query's result collection- of work packages overriding the query's persisted sums property.- example: 'true'- in: query- name: showSums- required: false- schema:- default: 'false'- type: boolean- - description: Indicates whether the timeline should be shown.- example: 'true'- in: query- name: timelineVisible- required: false- schema:- default: 'false'- type: boolean- - description: Overridden labels in the timeline view- example: "{}"- in: query- name: timelineLabels- required: false- schema:- default: "{}"- type: string- - description: Highlighting mode for the table view.- example: inline- in: query- name: highlightingMode- required: false- schema:- default: inline- type: string- - description: Highlighted attributes mode for the table view when `highlightingMode`- is `inline`. When set to `[]` all highlightable attributes will be returned- as `highlightedAttributes`.- example: "[]"- in: query- name: highlightedAttributes- required: false- schema:- default: "['type', 'priority']"- type: string- - description: Indicates whether the hierarchy mode should be enabled.- example: 'true'- in: query- name: showHierarchies- required: false- schema:- default: 'true'- type: boolean+ - description: Query id+ example: '1'+ in: path+ name: id+ required: true+ schema:+ type: integer+ - description: |-+ JSON specifying filter conditions.+ The filters provided as parameters are not applied to the query but are instead used to override the query's persisted filters.+ All filters also accepted by the work packages endpoint are accepted. If no filter is to be applied, the client should send an empty array (`[]`).+ example: '[{ "assignee": { "operator": "=", "values": ["1", "5"] }" }]'+ in: query+ name: filters+ required: false+ schema:+ default: '[{ "status_id": { "operator": "o", "values": null }}]'+ type: string+ - description: Page number inside the queries' result collection of work packages.+ example: '25'+ in: query+ name: offset+ required: false+ schema:+ default: 1+ type: integer+ - description: Number of elements to display per page for the queries' result collection+ of work packages.+ example: '25'+ in: query+ name: pageSize+ required: false+ schema:+ type: integer+ - description: Selected columns for the table view.+ example: "[]"+ in: query+ name: columns+ required: false+ schema:+ default: "['type', 'priority']"+ type: string+ - description: JSON specifying sort criteria. The sort criteria is applied to the+ query's result collection of work packages overriding the query's persisted+ sort criteria.+ example: '[["status", "asc"]]'+ in: query+ name: sortBy+ required: false+ schema:+ default: '[["id", "asc"]]'+ type: string+ - description: The column to group by. The grouping criteria is applied to the to+ the query's result collection of work packages overriding the query's persisted+ group criteria.+ example: status+ in: query+ name: groupBy+ required: false+ schema:+ type: string+ - description: Indicates whether properties should be summed up if they support+ it. The showSums parameter is applied to the to the query's result collection+ of work packages overriding the query's persisted sums property.+ example: 'true'+ in: query+ name: showSums+ required: false+ schema:+ default: 'false'+ type: boolean+ - description: Indicates whether the timeline should be shown.+ example: 'true'+ in: query+ name: timelineVisible+ required: false+ schema:+ default: 'false'+ type: boolean+ - description: Overridden labels in the timeline view+ example: "{}"+ in: query+ name: timelineLabels+ required: false+ schema:+ default: "{}"+ type: string+ - description: Highlighting mode for the table view.+ example: inline+ in: query+ name: highlightingMode+ required: false+ schema:+ default: inline+ type: string+ - description: Highlighted attributes mode for the table view when `highlightingMode`+ is `inline`. When set to `[]` all highlightable attributes will be returned+ as `highlightedAttributes`.+ example: "[]"+ in: query+ name: highlightedAttributes+ required: false+ schema:+ default: "['type', 'priority']"+ type: string+ - description: Indicates whether the hierarchy mode should be enabled.+ example: 'true'+ in: query+ name: showHierarchies+ required: false+ schema:+ default: 'true'+ type: booleanresponses:'200':content:application/hal+json:examples:- response:- value:- _embedded:- highlightedAttributes: []- results:- _embedded:- elements:- - "<--- shortened for brevity --->"- _links:- changeSize:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=%7Bsize%7D&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- createWorkPackage:- href: "/api/v3/work_packages/form"- method: post- createWorkPackageImmediate:- href: "/api/v3/work_packages"- method: post- jumpTo:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=%7Boffset%7D&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- templated: true- self:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- _type: WorkPackageCollection- count: 30- offset: 1- pageSize: 2- total: 234- _links:- columns:- - href: "/api/v3/queries/columns/id"- title: ID- - href: "/api/v3/queries/columns/subject"- title: Subject- - href: "/api/v3/queries/columns/type"- title: Type- - href: "/api/v3/queries/columns/status"- title: Status- - href: "/api/v3/queries/columns/priority"- title: Priority- - href: "/api/v3/queries/columns/assignee"- title: Assignee- - href: "/api/v3/queries/columns/updated_at"- title: Updated on- groupBy:- href:- title:- highlightedAttributes: []- project:- href: "/api/v3/projects/3"- title: copy- results:- href: "/api/v3/projects/3/work_packages?filters=%5B%7B%22status%22%3A%7B%22operator%22%3A%22o%22%2C%22values%22%3A%5B%5D%7D%7D%2C%7B%22dueDate%22%3A%7B%22operator%22%3A%22%3Ct%2B%22%2C%22values%22%3A%5B%221%22%5D%7D%7D%5D&offset=1&pageSize=2&sortBy=%5B%5B%22parent%22%2C%22desc%22%5D%5D"- self:- href: "/api/v3/queries/9"- title: fdsfdsfdsf- sortBy:- - href: "/api/v3/queries/sort_bys/parent-desc"- title: Parent (Descending)- user:- href: "/api/v3/users/1"- title: OpenProject Admin- _type: Query- createdAt: '2015-03-20T12:56:56Z'- filters:- - _links:- filter:- href: "/api/v3/queries/filters/status"- title: Status- operator:- href: "/api/v3/queries/operators/o"- title: open- schema:- href: "/api/v3/queries/filter_instance_schemas/status"- values: []- _type: StatusQueryFilter- name: Status- - _links:- filter:- href: "/api/v3/queries/filters/dueDate"- title: Finish date- operator:- href: "/api/v3/queries/operators/<t+"- title: in less than- schema:- href: "/api/v3/queries/filter_instance_schemas/dueDate"- _type: DueDateQueryFilter- name: Finish date- values:- - '1'- id: 9- name: fdsfdsfdsf- public: false- starred: false- sums: false- updatedAt: '2015-05-20T18:16:53Z'+ Query:+ "$ref": "../components/examples/query.yml"schema:"$ref": "../components/schemas/query_model.yml"description: OKdiff --git a/docs/api/apiv3/tags/queries.yml b/docs/api/apiv3/tags/queries.ymlindex 8d5407dcd69..113ce17c6b0 100644--- a/docs/api/apiv3/tags/queries.yml+++ b/docs/api/apiv3/tags/queries.yml@@ -1,6 +1,7 @@----description: |-- A query defines how work packages can be filtered and displayed. Clients can define a query once, store it, and use it later on to load the same set of filters.+description: |+ A query defines how work packages can be filtered and displayed.+ Clients can define a query once, store it, and use it later on to load the same set of filters and display options.## Actions@@ -13,40 +14,47 @@ description: |-## Linked Properties- | Property | Description | Type | Constraints | Supported operations |- | :--------------------: | ------------------------------------------------------ | --------------------- | ------------------------------------------- | -------------------- |- | self | This query | Query | not null | READ |- | user | The user that owns this query | User | not null | READ |- | project | The project on which this query operates | Project | | READ |- | columns | Ordered list of QueryColumns. The columns, when mapped to WorkPackage properties determine which WorkPackage properties to display | []QueryColumn | | READ |- | highlightedAttributes | **Only with valid Enterprise Token available:** List of QueryColumns that should get highlighted when `highlightingMode` is set to `inline`. | []QueryColumn | | READ |- | sortBy | Ordered list of QuerySortBys. Indicates the WorkPackage property the results will be ordered by as well as the direction | []QuerySortBy | | READ |- | groupBy | The WorkPackage property results of this query are grouped by | String | | READ |- | results | The list of work packages returned by applying the filters, sorting and grouping defined in the query | WorkPackageCollection | | READ |- | schema | This query's schema | Schema | | READ |+ | Property | Description | Type | Constraints | Supported operations |+ | :--------------------: | ------------------------------------------------------ | --------------------- | ------------------------------------------- | -------------------- |+ | self | This query | Query | not null | READ |+ | user | The user that owns this query | User | not null | READ |+ | project | The project on which this query operates | Project | | READ |+ | columns | Ordered list of QueryColumns. The columns, when mapped to WorkPackage properties determine which WorkPackage properties to display | []QueryColumn | | READ |+ | highlightedAttributes | **Only with valid Enterprise Token available:** List of QueryColumns that should get highlighted when `highlightingMode` is set to `inline`. | []QueryColumn | | READ |+ | sortBy | Ordered list of QuerySortBys. Indicates the WorkPackage property the results will be ordered by as well as the direction | []QuerySortBy | | READ |+ | groupBy | The WorkPackage property results of this query are grouped by | String | | READ |+ | results | The list of work packages returned by applying the filters, sorting and grouping defined in the query | WorkPackageCollection | | READ |+ | schema | This query's schema | Schema | | READ |Please note, that all the properties listed above will also be embedded when individual queries are returned but will not be embedded when a list of queries is returned. Whether the properties are embedded or not may be subject to change in the future.++ The `columns` and `highlightedAttributes` properties will be moved into the `QueryProjection::Table` so it is deprecated to have it listed within the Query directly.## Local Properties- | Property | Description | Type | Constraints | Supported operations |- | :--------------: | ------------------------------------------------------ | ----------- | ------------------------------------ | -------------------- |- | id | Query id | Integer | x > 0 | READ |- | name | Query name | String | | READ |- | filters | A set of QueryFilters which will be applied to the work packages to determine the resulting work packages | []QueryFilterInstance | | READ |- | sums | Should sums (of supported properties) be shown? | Boolean | | READ |- | timelineVisible | Should the timeline mode be shown? | Boolean | | READ |- | timelineLabels | Which labels are shown in the timeline, empty when default | QueryTimelineLabels | | READ |- | timelineZoomLevel| Which zoom level should the timeline be rendered in? | String | days, weeks, months, quarters, years | READ |- | highlightingMode | Which highlighting mode should the table have? | String | none, inline, status, priority, type | READ |- | showHierarchies | Should the hierarchy mode be enabled? | Boolean | | READ |- | hidden | Should the query be hidden from the query list? | Boolean | | READ |- | public | Can users besides the owner see the query? | Boolean | | READ |- | starred | Should the query be highlighted to the user? | Boolean | | READ |- | createdAt | Time of creation | DateTime | not null | READ |- | updatedAt | Time of the most recent change to the query | DateTime | not null | READ |+ | Property | Description | Type | Constraints | Supported operations |+ | :--------------: | ------------------------------------------------------ | ----------- | ------------------------------------ | -------------------- |+ | id | Query id | Integer | x > 0 | READ |+ | name | Query name | String | | READ/WRITE |+ | filters | A set of QueryFilters which will be applied to the work packages to determine the resulting work packages | []QueryFilterInstance | | READ/WRITE |+ | projections | A set of `QueryProjection` objects where each represents one projection (display option) defined for the query. | []QueryProjection | | READ/WRITE |+ | sums | Should sums (of supported properties) be shown? | Boolean | | READ/WRITE |+ | timelineVisible | Should the timeline mode be shown? | Boolean | | READ/WRITE |+ | timelineLabels | Which labels are shown in the timeline, empty when default | QueryTimelineLabels | | READ/WRITE |+ | timelineZoomLevel| Which zoom level should the timeline be rendered in? | String | days, weeks, months, quarters, years | READ/WRITE |+ | highlightingMode | Which highlighting mode should the table have? | String | none, inline, status, priority, type | READ/WRITE |+ | showHierarchies | Should the hierarchy mode be enabled? | Boolean | | READ/WRITE |+ | hidden | Should the query be hidden from the query list? | Boolean | | READ/WRITE |+ | public | Can users besides the owner see the query? | Boolean | | READ/WRITE |+ | starred | Should the query be highlighted to the user? | Boolean | | READ |+ | createdAt | Time of creation | DateTime | not null | READ |+ | updatedAt | Time of the most recent change to the query | DateTime | not null | READ |A query that is not assigned to a project (`"project": null`) is called a global query. Global queries filter work packages regardless of the project they are assigned to. As such, a different set of filters exists for those queries.++ The `hidden` property is deprecated as it will be replaced by `QueryProjection`.++ The `timelineVisible`, `timelineLabels`, `timelineZoomLevel`, `highlightingMode` and `showHierarchies` properties will be moved into the more appropriate projections (`QueryProjection::Gantt` and `QueryProjection::Table`) so it is deprecated to have them within the Query directly.## Query Filter Instance@@ -111,4 +119,10 @@ description: |-}```++ ## QueryProjection++ A QueryProjection represents a projection that is to be applied to the filtered work packages. A projection might be a graph, a table, a calendar or basically every other representation.+ Each projection requires its own set of configurations. E.g. for a table, specifying the columns of the table is usefull, whereas it does not make sense for a graph. Because of this,+ the property and link set will differ heavily between each type of projection.name: Queriesdiff --git a/docs/api/apiv3/tags/query_projection_schema.yml b/docs/api/apiv3/tags/query_projection_schema.ymlnew file mode 100644index 00000000000..ef3059ee790--- /dev/null+++ b/docs/api/apiv3/tags/query_projection_schema.yml@@ -0,0 +1,14 @@+---+description: |-+ A QueryProjection Schema describes the various types of QueryProjections available. There is no `QueryProject` type in itself+ but only subtypes of it e.g. `QueryProjection::Table` and `QueryProjection::Gantt`.+ Each subtype has properties of it's own so asside from the `_type` property, the other properties will be different from+ subtype to subtype.++ ## Linked Properties++ | Link | Description | Type | Constraints | Supported operations |+ | :-------------------: | ---------------------------------------- | ------------- | -------- | -------------------- |+ | self | This schema | QueryProjectionSchema | not null | READ |++name: Query Projection Schemadiff --git a/docs/api/apiv3/tags/schemas.yml b/docs/api/apiv3/tags/schemas.ymlindex 5b256f70741..127662e4fdc 100644--- a/docs/api/apiv3/tags/schemas.yml+++ b/docs/api/apiv3/tags/schemas.yml@@ -50,6 +50,7 @@ description: |-| writable | If false it is not allowed to **change** the properties value | Boolean | true || location | If present, contains a reference to the location of the property in the JSON | String | || description | If present, contains a formattable, human readable description | Formattable | |+ | deprecated | If present, the client should considere the existence of the property depreacated | Boolean | false |All of the above properties that do not have a default value *must* be present in the schema.For properties that have a default value, the client can assume the default value, if the property is missing.diff --git a/lib/api/open_api.rb b/lib/api/open_api.rbindex 965759dbc45..f8708047a2e 100644--- a/lib/api/open_api.rb+++ b/lib/api/open_api.rb@@ -3,24 +3,36 @@ module APIextend selfdef spec- @spec ||= begin- spec_path = Rails.application.root.join("docs/api/apiv3/openapi-spec.yml")-- if spec_path.exist?- assemble_spec spec_path- else- raise "Could not find openapi-spec.yml under #{spec_path}"- end- end+ spec = if Rails.env.development?+ load_spec+ else+ memoized_spec+ end- @spec["servers"] = [+ spec["servers"] = [{"description" => "This server","url" => "#{Setting.protocol}://#{Setting.host_name}/"}]- @spec+ spec+ end++ private++ def memoized_spec+ @memoized_spec ||= load_spec+ end++ def load_spec+ spec_path = Rails.application.root.join("docs/api/apiv3/openapi-spec.yml")++ if spec_path.exist?+ assemble_spec spec_path+ else+ raise "Could not find openapi-spec.yml under #{spec_path}"+ endenddef assemble_spec(file_path)@@ -102,7 +114,14 @@ module APIfile = schema_file ref_path, path: path, root_path: root_pathspec_path = schema_path ref_path, path: path, root_path: root_path- root_spec.dig(*spec_path).find { |_k, v| v["$ref"] == file }.first+ spec_files = root_spec.dig(*spec_path)++ raise "Path not defined #{spec_path}" unless spec_files++ spec_file = spec_files.find { |_k, v| v["$ref"] == file }&.first+ raise "Reference '#{file}' not valid within #{spec_path}" unless spec_file++ spec_fileendendend