diff --git a/packages/downgrader/tests/v3.1-to-v3.0.test.ts b/packages/downgrader/tests/v3.1-to-v3.0.test.ts index eae773f..b24e9b2 100644 --- a/packages/downgrader/tests/v3.1-to-v3.0.test.ts +++ b/packages/downgrader/tests/v3.1-to-v3.0.test.ts @@ -2981,7 +2981,12 @@ describe('downgradeSchemaV31ToV30', () => { Nested: ref('FieldOptions/Text/properties/type'), Kept: ref('FieldOptions/x-note'), Removed: ref('FieldOptions/prefixItems/0'), + // A key 3.0 keeps, and a key of another component type, are not renamed. + Negated: { not: { type: 'string' } }, + IntoKept: ref('Negated/not'), + IntoParameter: { $ref: '#/components/parameters/Query/schema' }, }, + parameters: { Query: { name: 'q', in: 'query', schema: { type: 'string' } } }, }, }) // The discriminator goes, as its mapping would dangle. @@ -2997,6 +3002,12 @@ describe('downgradeSchemaV31ToV30', () => { Nested: { type: 'string', enum: ['Text'] }, Kept: ref('FieldOptions/x-note'), Removed: ref('FieldOptions/prefixItems/0'), + Negated: { not: { type: 'string' } }, + }) + expect(out.components?.parameters?.Query).toMatchObject({ schema: { type: 'string' } }) + expect(out.components?.schemas?.IntoKept).toStrictEqual(ref('Negated/not')) + expect(out.components?.schemas?.IntoParameter).toStrictEqual({ + $ref: '#/components/parameters/Query/schema', }) })