Skip to content

Commit 8089b5e

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(oci-logging): accept absent log group descriptions
1 parent 9d7c371 commit 8089b5e

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

apps/sim/lib/internal/oci-logging/operations.test.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,29 @@ const execute = (operation: OciLoggingOperation, input: unknown, signal?: AbortS
5151
describe('OCI Logging provider operations', () => {
5252
beforeEach(() => vi.clearAllMocks())
5353

54+
it.each([undefined, null, 'Synthetic group'])(
55+
'accepts optional log-group descriptions in lists and details: %s',
56+
async (description) => {
57+
const wireGroup = { ...group, description }
58+
const expectedGroup = {
59+
...group,
60+
...(description === undefined ? {} : { description: description ?? undefined }),
61+
}
62+
respond([wireGroup])
63+
expect(await execute('list_log_groups', { compartmentId: 'compartment' })).toMatchObject({
64+
logGroups: [expectedGroup],
65+
})
66+
respond(wireGroup)
67+
expect(await execute('get_log_group', { logGroupId: 'group' })).toMatchObject({
68+
logGroup: expectedGroup,
69+
})
70+
respond({ ...group, description: 42 })
71+
await expect(execute('get_log_group', { logGroupId: 'group' })).rejects.toBeInstanceOf(
72+
OciLoggingResponseError
73+
)
74+
}
75+
)
76+
5477
it('accepts absent custom-log configuration and system tags in lists and details', async () => {
5578
const wireLog = { ...log, configuration: null, systemTags: null }
5679
respond([wireLog])

apps/sim/lib/internal/oci-logging/schema.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,10 @@ export const logGroupSchema = z.object({
180180
id,
181181
compartmentId: id,
182182
displayName: name,
183-
description: z.string().optional(),
183+
description: z
184+
.string()
185+
.nullish()
186+
.transform((value) => value ?? undefined),
184187
lifecycleState: lifecycle.optional(),
185188
...resourceFields,
186189
})

0 commit comments

Comments
 (0)