diff --git a/x-pack/plugins/cases/common/api/cases/case.ts b/x-pack/plugins/cases/common/api/cases/case.ts index 61c31e9cff515..acfca22e70498 100644 --- a/x-pack/plugins/cases/common/api/cases/case.ts +++ b/x-pack/plugins/cases/common/api/cases/case.ts @@ -213,7 +213,7 @@ export const CasesFindRequestRt = rt.exact( /** * Tags to filter by */ - tags: rt.union([limitedArraySchema(rt.string, 0, MAX_TAGS_FILTER_LENGTH), rt.string]), + tags: rt.union([limitedArraySchema(rt.string, 0, MAX_TAGS_FILTER_LENGTH, 'tags'), rt.string]), /** * The status of the case (open, closed, in-progress) */ @@ -225,11 +225,17 @@ export const CasesFindRequestRt = rt.exact( /** * The uids of the user profiles to filter by */ - assignees: rt.union([limitedArraySchema(rt.string, 0, MAX_ASSIGNEES_FILTER_LENGTH), rt.string]), + assignees: rt.union([ + limitedArraySchema(rt.string, 0, MAX_ASSIGNEES_FILTER_LENGTH, 'assignees'), + rt.string, + ]), /** * The reporters to filter by */ - reporters: rt.union([limitedArraySchema(rt.string, 0, MAX_REPORTERS_FILTER_LENGTH), rt.string]), + reporters: rt.union([ + limitedArraySchema(rt.string, 0, MAX_REPORTERS_FILTER_LENGTH, 'reporters'), + rt.string, + ]), /** * Operator to use for the `search` field */ diff --git a/x-pack/plugins/cases/docs/openapi/bundled.json b/x-pack/plugins/cases/docs/openapi/bundled.json index a367593d6b89e..2ccef20d760a1 100644 --- a/x-pack/plugins/cases/docs/openapi/bundled.json +++ b/x-pack/plugins/cases/docs/openapi/bundled.json @@ -232,7 +232,7 @@ "items": { "type": "string" }, - "maximum": 100 + "maxItems": 100 } ] } @@ -298,7 +298,7 @@ "items": { "type": "string" }, - "maximum": 100 + "maxItems": 100 } ] }, @@ -378,7 +378,7 @@ "items": { "type": "string" }, - "maximum": 100 + "maxItems": 100 } ] }, diff --git a/x-pack/plugins/cases/docs/openapi/bundled.yaml b/x-pack/plugins/cases/docs/openapi/bundled.yaml index dfb37c895902d..30ca1177c1390 100644 --- a/x-pack/plugins/cases/docs/openapi/bundled.yaml +++ b/x-pack/plugins/cases/docs/openapi/bundled.yaml @@ -141,7 +141,7 @@ paths: - type: array items: type: string - maximum: 100 + maxItems: 100 - name: category in: query description: Filters the returned cases by category. Limited to 100 categories. @@ -178,7 +178,7 @@ paths: - type: array items: type: string - maximum: 100 + maxItems: 100 example: elastic - name: search in: query @@ -225,7 +225,7 @@ paths: - type: array items: type: string - maximum: 100 + maxItems: 100 example: tag-1 - name: to in: query diff --git a/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@_find.yaml b/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@_find.yaml index 09c28446def69..d02399d081f33 100644 --- a/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@_find.yaml +++ b/x-pack/plugins/cases/docs/openapi/paths/s@{spaceid}@api@cases@_find.yaml @@ -20,7 +20,7 @@ get: - type: array items: type: string - maximum: 100 + maxItems: 100 - name: category in: query description: Filters the returned cases by category. Limited to 100 categories. @@ -62,7 +62,7 @@ get: - type: array items: type: string - maximum: 100 + maxItems: 100 example: elastic - name: search in: query @@ -109,7 +109,7 @@ get: - type: array items: type: string - maximum: 100 + maxItems: 100 example: tag-1 - name: to in: query diff --git a/x-pack/plugins/cases/server/client/cases/find.test.ts b/x-pack/plugins/cases/server/client/cases/find.test.ts index 76e15425ecef5..b7d9d9117ad7e 100644 --- a/x-pack/plugins/cases/server/client/cases/find.test.ts +++ b/x-pack/plugins/cases/server/client/cases/find.test.ts @@ -126,7 +126,7 @@ describe('find', () => { const findRequest = createCasesClientMockFindRequest({ tags }); await expect(find(findRequest, clientArgs)).rejects.toThrowError( - 'Error: array must be of length <= 100' + `Error: The length of the field tags is too long. Array must be of length <= ${MAX_TAGS_FILTER_LENGTH}` ); }); @@ -136,7 +136,7 @@ describe('find', () => { const findRequest = createCasesClientMockFindRequest({ assignees }); await expect(find(findRequest, clientArgs)).rejects.toThrowError( - 'Error: array must be of length <= 100' + `Error: The length of the field assignees is too long. Array must be of length <= ${MAX_ASSIGNEES_FILTER_LENGTH}` ); }); @@ -146,7 +146,7 @@ describe('find', () => { const findRequest = createCasesClientMockFindRequest({ reporters }); await expect(find(findRequest, clientArgs)).rejects.toThrowError( - 'Error: array must be of length <= 100' + `Error: The length of the field reporters is too long. Array must be of length <= ${MAX_REPORTERS_FILTER_LENGTH}.` ); }); });