From db0b096c0a1dd58eb2e9d2e080ca5e3538be71cf Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 28 Mar 2022 18:33:54 +0100 Subject: [PATCH] Fix for #5117 - raised a point that the docs didn't describe where to put properties for a query when running through the public API - fixing the spec. --- packages/server/specs/openapi.json | 26 ++++++++++++++++-- packages/server/specs/openapi.yaml | 24 +++++++++++++--- packages/server/specs/resources/query.js | 32 ++++++++++++++++++---- packages/server/src/definitions/openapi.ts | 14 ++++++++-- 4 files changed, 82 insertions(+), 14 deletions(-) diff --git a/packages/server/specs/openapi.json b/packages/server/specs/openapi.json index 6ca1a5b9fb..30ef0a8c6f 100644 --- a/packages/server/specs/openapi.json +++ b/packages/server/specs/openapi.json @@ -1260,10 +1260,30 @@ ] }, "executeQuery": { - "description": "The query body must contain the required parameters for the query, this depends on query type, setup and bindings.", + "description": "The parameters required for executing a query.", "type": "object", - "additionalProperties": { - "description": "Key value properties of any type, depending on the query output schema." + "properties": { + "parameters": { + "type": "object", + "description": "This contains the required parameters for the query, this depends on query type, setup and bindings.", + "additionalProperties": { + "description": "Key value properties of any type, depending on the query output schema." + } + }, + "pagination": { + "type": "object", + "description": "For supported query types (currently on REST) pagination can be performed using these properties.", + "properties": { + "page": { + "type": "string", + "description": "The page which has been returned from a previous query." + }, + "limit": { + "type": "number", + "description": "The number of rows to return per page." + } + } + } } }, "executeQueryOutput": { diff --git a/packages/server/specs/openapi.yaml b/packages/server/specs/openapi.yaml index c4d9808c86..ed55df953a 100644 --- a/packages/server/specs/openapi.yaml +++ b/packages/server/specs/openapi.yaml @@ -951,11 +951,27 @@ components: required: - data executeQuery: - description: The query body must contain the required parameters for the query, - this depends on query type, setup and bindings. + description: The parameters required for executing a query. type: object - additionalProperties: - description: Key value properties of any type, depending on the query output schema. + properties: + parameters: + type: object + description: This contains the required parameters for the query, this depends + on query type, setup and bindings. + additionalProperties: + description: Key value properties of any type, depending on the query output + schema. + pagination: + type: object + description: For supported query types (currently on REST) pagination can be + performed using these properties. + properties: + page: + type: string + description: The page which has been returned from a previous query. + limit: + type: number + description: The number of rows to return per page. executeQueryOutput: type: object properties: diff --git a/packages/server/specs/resources/query.js b/packages/server/specs/resources/query.js index df532c9a3a..d4a4882fb2 100644 --- a/packages/server/specs/resources/query.js +++ b/packages/server/specs/resources/query.js @@ -124,12 +124,34 @@ const querySchema = object( ) const executeQuerySchema = { - description: - "The query body must contain the required parameters for the query, this depends on query type, setup and bindings.", + description: "The parameters required for executing a query.", type: "object", - additionalProperties: { - description: - "Key value properties of any type, depending on the query output schema.", + properties: { + parameters: { + type: "object", + description: + "This contains the required parameters for the query, this depends on query type, setup and bindings.", + additionalProperties: { + description: + "Key value properties of any type, depending on the query output schema.", + }, + }, + pagination: { + type: "object", + description: + "For supported query types (currently on REST) pagination can be performed using these properties.", + properties: { + page: { + type: "string", + description: + "The page which has been returned from a previous query.", + }, + limit: { + type: "number", + description: "The number of rows to return per page.", + }, + }, + }, }, } diff --git a/packages/server/src/definitions/openapi.ts b/packages/server/src/definitions/openapi.ts index c8b518107c..4fd11f88e9 100644 --- a/packages/server/src/definitions/openapi.ts +++ b/packages/server/src/definitions/openapi.ts @@ -935,8 +935,18 @@ export interface components { _id: string; }[]; }; - /** @description The query body must contain the required parameters for the query, this depends on query type, setup and bindings. */ - executeQuery: { [key: string]: unknown }; + /** @description The parameters required for executing a query. */ + executeQuery: { + /** @description This contains the required parameters for the query, this depends on query type, setup and bindings. */ + parameters?: { [key: string]: unknown }; + /** @description For supported query types (currently on REST) pagination can be performed using these properties. */ + pagination?: { + /** @description The page which has been returned from a previous query. */ + page?: string; + /** @description The number of rows to return per page. */ + limit?: number; + }; + }; executeQueryOutput: { /** @description The data response from the query. */ data: { [key: string]: unknown }[];