Skip to content
Merged
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c848f6e
test(downgrader): cover the cut-$ref reset, writeOnly and $ref tags, …
claude Nov 2, 2026
17b0cc9
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
90d9ae5
fix(downgrader): leave out a 3.2 security requirement name whose sche…
claude Nov 2, 2026
71b348d
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
720cf6e
test(downgrader): cover a 3.2 security requirement name holding undef…
claude Nov 2, 2026
de5d602
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
6c5d811
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
85e0979
test(downgrader): cover a null branch beside enums in a malformed anyOf
claude Nov 2, 2026
dd95369
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
170d121
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
4ea0add
test(downgrader): keep the allOf beside a restricting keyword on a ta…
claude Nov 2, 2026
eef3ee2
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
c7b4e1b
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
7531a72
docs(downgrader): a $ref into an anyOf removed for a media-type-only …
claude Nov 2, 2026
4c4b7bf
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
946a4f6
docs(downgrader): a $ref into a removed not dangles
claude Nov 2, 2026
ae2be47
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
69c1aae
docs(downgrader): a $ref into a 3.2 itemSchema that moves into schema…
claude Nov 2, 2026
91533fb
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
f4f0c9b
docs(downgrader): a $ref by index past a removed 3.2 querystring para…
claude Nov 2, 2026
74e3b3b
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
2360af7
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
25fb9ca
fix(downgrader): keep a $ref bare beside only a 3.0-style nullable
claude Nov 2, 2026
5658ff8
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
ffa455e
fix(downgrader): keep a $ref bare beside identifiers 3.0 removes
claude Nov 2, 2026
114cae7
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
24cfba2
fix(downgrader): keep null in a loop of nullable $ref pairs
claude Nov 2, 2026
bc1fe15
fix(downgrader): follow nullable pairs beside annotations 3.0 drops
claude Nov 2, 2026
f3cc671
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
47d2d6c
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
f7cdda7
fix(downgrader): drop a discriminator that a $ref or type list would …
claude Nov 2, 2026
660afb1
docs(downgrader): note the discriminator dropped beside a $ref or typ…
claude Nov 2, 2026
6718cbd
fix(downgrader): keep a $ref bare beside only a removed discriminator
claude Nov 2, 2026
272eaf2
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
80c69ae
test(downgrader): keep a discriminator beside a $ref and an anyOf or …
claude Nov 2, 2026
a8c2c54
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
c80c90c
fix(downgrader): follow a null pair nested in a null pair around a $r…
claude Nov 2, 2026
e47c94c
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
96fe14d
fix(downgrader): stop the nested pair walk at a cycle of objects
claude Nov 2, 2026
7645f9b
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
b3e2536
test(downgrader): follow a $ref beside an object cycle in a nested nu…
claude Nov 2, 2026
dbe21f7
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
956f651
fix(downgrader): keep a null pair only when its $ref would loop back …
claude Nov 2, 2026
637a684
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
587947c
refactor(downgrader): follow any $ref in the 3.0 loop check, and test…
claude Nov 2, 2026
5fb05d0
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
d8db861
test(downgrader): pin a oneOf pair to a null-admitting $ref, and null…
claude Nov 2, 2026
ca238b9
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
6f6a0ed
Merge remote-tracking branch 'origin/main' into claude/project-thread…
claude Nov 2, 2026
be4ac8b
test(downgrader): pin an enum branch beside null, a $ref beside a nul…
claude Nov 2, 2026
abcbc8f
test(downgrader): clearer comment and name in the $ref-beside-type case
claude Nov 2, 2026
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
26 changes: 26 additions & 0 deletions packages/downgrader/tests/v3.1-to-v3.0.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,15 @@ describe('downgradeSchemaV31ToV30', () => {
expect(schema({ type: 'string', nullable: true })).toEqual({ type: 'string', nullable: true })
expect(schema({ nullable: true })).toEqual({})
expect(schema({ type: 'string', nullable: false })).toEqual({ type: 'string' })
// Beside a `type` list that holds null, it adds nothing, so a `oneOf` with a `$ref` to it stays.
const branches = [{ $ref: '#/components/schemas/T' }, { type: 'integer' as const }]
expect(
convert({
components: {
schemas: { T: { type: ['array', 'null'], nullable: true }, N: { oneOf: branches } },
},
}).components?.schemas?.N,
).toEqual({ oneOf: branches })
// Beside a `$ref` without a `type`, as aide writes it, the `$ref` stays bare
// rather than an `allOf` with nothing beside it.
const pet = '#/components/schemas/Pet'
Expand Down Expand Up @@ -776,6 +785,12 @@ describe('downgradeSchemaV31ToV30', () => {
anyOf: [{ type: 'null' }, { type: 'string' }, { type: 'null' }],
}),
).toEqual({ type: 'string', nullable: true })
// A branch whose `enum` rejects null is not the null branch beside it.
expect(
downgradeSchemaV31ToV30({
anyOf: [{ type: ['string', 'null'], enum: ['a'] }, { type: 'null' }],
}),
).toEqual({ anyOf: [{ type: 'string', enum: ['a'], nullable: true }, onlyNull] })
// One branch holds no null to merge, as Valibot writes a union of one schema.
expect(downgradeSchemaV31ToV30({ anyOf: [{ type: 'string' }] })).toEqual({
anyOf: [{ type: 'string' }],
Expand Down Expand Up @@ -1296,6 +1311,17 @@ describe('downgradeSchemaV31ToV30', () => {
description: 'A',
anyOf: [onlyNull, ref],
})
// The target of a `$ref` beside the `type` can reject null too, so the pair stays.
const pet: OpenAPIV3_1.SchemaObject = {
$ref: '#/components/schemas/Base',
type: ['object', 'null'],
}
const nullablePet = { anyOf: [{ type: 'null' as const }, ref] }
expect(
convert({
components: { schemas: { Base: { type: 'object' }, Pet: pet, Owner: nullablePet } },
}).components?.schemas?.Owner,
).toEqual({ anyOf: [onlyNull, ref] })
// A `oneOf` rejects the null that both branches match, so it stays.
const pair = { oneOf: [{ type: 'null' as const }, ref] }
expect(
Expand Down
Loading