Skip to content

[CASEM] Document case management attributes endpoints #2489

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
169 changes: 123 additions & 46 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6790,7 +6790,7 @@ components:
description: A case
properties:
attributes:
$ref: '#/components/schemas/CaseAttributes'
$ref: '#/components/schemas/CaseResourceAttributes'
id:
description: Case's identifier
example: aeadc05e-98a8-11ec-ac2c-da7ad0900001
Expand Down Expand Up @@ -6848,52 +6848,11 @@ components:
- data
type: object
CaseAttributes:
description: Case attributes
properties:
archived_at:
description: Timestamp of when the case was archived
format: date-time
nullable: true
readOnly: true
type: string
closed_at:
description: Timestamp of when the case was closed
format: date-time
nullable: true
readOnly: true
type: string
created_at:
description: Timestamp of when the case was created
format: date-time
readOnly: true
type: string
description:
description: Description
type: string
jira_issue:
$ref: '#/components/schemas/JiraIssue'
key:
description: Key
example: CASEM-4523
type: string
modified_at:
description: Timestamp of when the case was last modified
format: date-time
nullable: true
readOnly: true
type: string
priority:
$ref: '#/components/schemas/CasePriority'
service_now_ticket:
$ref: '#/components/schemas/ServiceNowTicket'
status:
$ref: '#/components/schemas/CaseStatus'
title:
description: Title
example: Memory leak investigation on API
additionalProperties:
items:
type: string
type:
$ref: '#/components/schemas/CaseType'
type: array
description: The definition of `CaseAttributes` object.
type: object
CaseCreate:
description: Case creation data
Expand Down Expand Up @@ -6991,6 +6950,56 @@ components:
project:
$ref: '#/components/schemas/ProjectRelationship'
type: object
CaseResourceAttributes:
description: Case attributes
properties:
archived_at:
description: Timestamp of when the case was archived
format: date-time
nullable: true
readOnly: true
type: string
attributes:
$ref: '#/components/schemas/CaseAttributes'
closed_at:
description: Timestamp of when the case was closed
format: date-time
nullable: true
readOnly: true
type: string
created_at:
description: Timestamp of when the case was created
format: date-time
readOnly: true
type: string
description:
description: Description
type: string
jira_issue:
$ref: '#/components/schemas/JiraIssue'
key:
description: Key
example: CASEM-4523
type: string
modified_at:
description: Timestamp of when the case was last modified
format: date-time
nullable: true
readOnly: true
type: string
priority:
$ref: '#/components/schemas/CasePriority'
service_now_ticket:
$ref: '#/components/schemas/ServiceNowTicket'
status:
$ref: '#/components/schemas/CaseStatus'
title:
description: Title
example: Memory leak investigation on API
type: string
type:
$ref: '#/components/schemas/CaseType'
type: object
CaseResourceType:
default: case
description: Case resource type
Expand Down Expand Up @@ -7055,6 +7064,33 @@ components:
type: string
x-enum-varnames:
- STANDARD
CaseUpdateAttributes:
description: Case update attributes
properties:
attributes:
$ref: '#/components/schemas/CaseUpdateAttributesAttributes'
type:
$ref: '#/components/schemas/CaseResourceType'
required:
- attributes
- type
type: object
CaseUpdateAttributesAttributes:
description: Case update attributes attributes
properties:
attributes:
$ref: '#/components/schemas/CaseAttributes'
required:
- attributes
type: object
CaseUpdateAttributesRequest:
description: Case update attributes request
properties:
data:
$ref: '#/components/schemas/CaseUpdateAttributes'
required:
- data
type: object
CaseUpdatePriority:
description: Case priority status
properties:
Expand Down Expand Up @@ -45403,6 +45439,47 @@ paths:
x-menu-order: 6
x-undo:
type: idempotent
/api/v2/cases/{case_id}/attributes:
post:
description: Update case attributes
operationId: UpdateAttributes
parameters:
- $ref: '#/components/parameters/CaseIDPathParameter'
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/CaseUpdateAttributesRequest'
description: Case attributes update payload
required: true
responses:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/CaseResponse'
description: OK
'400':
$ref: '#/components/responses/BadRequestResponse'
'401':
$ref: '#/components/responses/UnauthorizedResponse'
'403':
$ref: '#/components/responses/ForbiddenResponse'
'404':
$ref: '#/components/responses/NotFoundResponse'
'429':
$ref: '#/components/responses/TooManyRequestsResponse'
security:
- apiKeyAuth: []
appKeyAuth: []
- AuthZ:
- cases_write
summary: Update case attributes
tags:
- Case Management
x-menu-order: 10
x-undo:
type: idempotent
/api/v2/cases/{case_id}/priority:
post:
description: Update case priority
Expand Down
24 changes: 24 additions & 0 deletions features/v2/case_management.feature
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,30 @@ Feature: Case Management
When the request is sent
Then the response status is 200 OK

@team:DataDog/case-management
Scenario: Update case attributes returns "Bad Request" response
Given new "UpdateAttributes" request
And request contains "case_id" parameter from "case.id"
And body with value {"data": {"attributes": {}, "type": "case"}}
When the request is sent
Then the response status is 400 Bad Request

@team:DataDog/case-management
Scenario: Update case attributes returns "Not Found" response
Given new "UpdateAttributes" request
And request contains "case_id" parameter from "67d80aa3-36ff-44b9-a694-c501a7591737"
And body with value { "data": { "type": "case", "attributes": { "attributes": { "service": "web-store"}}}}
When the request is sent
Then the response status is 404 Not Found

@team:DataDog/case-management
Scenario: Update case attributes returns "OK" response
Given new "UpdateAttributes" request
And request contains "case_id" parameter from "case.id"
And body with value {"data": {"attributes": {"attributes": {"service": ["web-store", "web-api"], "env": ["test"], "team": ["engineer"]}}, "type": "case"}}
When the request is sent
Then the response status is 200 OK

@team:DataDog/case-management
Scenario: Update case priority returns "Bad Request" response
Given new "UpdatePriority" request
Expand Down
6 changes: 6 additions & 0 deletions features/v2/undo.json
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,12 @@
"type": "idempotent"
}
},
"UpdateAttributes": {
"tag": "Case Management",
"undo": {
"type": "idempotent"
}
},
"UpdatePriority": {
"tag": "Case Management",
"undo": {
Expand Down
11 changes: 11 additions & 0 deletions private/bdd_runner/src/support/scenarios_model_mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,17 @@ export const ScenariosModelMappings: { [key: string]: OperationMapping } = {
},
operationResponseType: "CaseResponse",
},
"CaseManagementApi.V2.UpdateAttributes": {
caseId: {
type: "string",
format: "",
},
body: {
type: "CaseUpdateAttributesRequest",
format: "",
},
operationResponseType: "CaseResponse",
},
"CaseManagementApi.V2.UpdatePriority": {
caseId: {
type: "string",
Expand Down
Loading
Loading