Skip to content

Commit 25b99eb

Browse files
committed
fix: add nullable to null test
1 parent eb4260b commit 25b99eb

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
openapi: 3.1.0
2+
info:
3+
title: test
4+
version: 0.1.0
5+
paths:
6+
/path1:
7+
get:
8+
responses:
9+
'200':
10+
description: OK
11+
content:
12+
'application/json':
13+
schema:
14+
anyOf:
15+
- type: string
16+
- type: 'null'
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
openapi: 3.0.3
2+
info:
3+
title: test
4+
version: 0.1.0
5+
paths:
6+
/path1:
7+
get:
8+
responses:
9+
'200':
10+
description: OK
11+
content:
12+
'application/json':
13+
schema:
14+
type: string
15+
nullable: true

test/oas-3_0-to-3_1.test.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,25 @@ describe('OpenAPI 3.0 to 3.1 Migration Tests', () => {
4242
}),
4343
]))
4444
})
45+
46+
test.skip('nullable-to-union', () => {
47+
// Load the before and after files
48+
const beforePath = './test/helper/resources/3_0-to-3_1/nullable-to-union/before.yaml'
49+
const afterPath = './test/helper/resources/3_0-to-3_1/nullable-to-union/after.yaml'
50+
51+
const beforeSource = load(readFileSync(beforePath).toString())
52+
const afterSource = load(readFileSync(afterPath).toString())
53+
54+
// Call apiDiff
55+
const { diffs } = apiDiff(beforeSource, afterSource, {
56+
...TEST_NORMALIZE_OPTIONS,
57+
beforeSource,
58+
afterSource,
59+
})
60+
61+
// Check the result - expecting changes from nullable: true to union types
62+
expect(diffs).toEqual(diffsMatcher([
63+
// TODO: Add assertions for nullable to union type changes
64+
]))
65+
})
4566
})

0 commit comments

Comments
 (0)