Skip to content

Commit

Permalink
Update tests and documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
adcoelho committed Jun 29, 2023
1 parent fc1f057 commit bd2a000
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
12 changes: 9 additions & 3 deletions x-pack/plugins/cases/common/api/cases/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
*/
Expand All @@ -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
*/
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/docs/openapi/bundled.json
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@
"items": {
"type": "string"
},
"maximum": 100
"maxItems": 100
}
]
}
Expand Down Expand Up @@ -298,7 +298,7 @@
"items": {
"type": "string"
},
"maximum": 100
"maxItems": 100
}
]
},
Expand Down Expand Up @@ -378,7 +378,7 @@
"items": {
"type": "string"
},
"maximum": 100
"maxItems": 100
}
]
},
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/docs/openapi/bundled.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -178,7 +178,7 @@ paths:
- type: array
items:
type: string
maximum: 100
maxItems: 100
example: elastic
- name: search
in: query
Expand Down Expand Up @@ -225,7 +225,7 @@ paths:
- type: array
items:
type: string
maximum: 100
maxItems: 100
example: tag-1
- name: to
in: query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -62,7 +62,7 @@ get:
- type: array
items:
type: string
maximum: 100
maxItems: 100
example: elastic
- name: search
in: query
Expand Down Expand Up @@ -109,7 +109,7 @@ get:
- type: array
items:
type: string
maximum: 100
maxItems: 100
example: tag-1
- name: to
in: query
Expand Down
6 changes: 3 additions & 3 deletions x-pack/plugins/cases/server/client/cases/find.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`
);
});

Expand All @@ -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}`
);
});

Expand All @@ -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}.`
);
});
});
Expand Down

0 comments on commit bd2a000

Please sign in to comment.