fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(allOf): add comprehensive tests for allOf additionalProperties: false fix

- Add OpenAPI 2.0 test specification with allOf + additionalProperties: false schema
- Add 2.0.x test case to validate fix behavior across all parser versions
- Update snapshots for all parsers showing clean intersection types (Foo & {})
- Validates that empty objects with additionalProperties: false in allOf no longer generate [key: string]: never signatures

MaxwellAt 9a8a56ca 2e259121

+73 -6
+7
packages/openapi-ts-tests/main/test/2.0.x.test.ts
··· 46 46 const scenarios = [ 47 47 { 48 48 config: createConfig({ 49 + input: 'additional-properties-false.json', 50 + output: 'additional-properties-false', 51 + }), 52 + description: 'forbids arbitrary properties on objects', 53 + }, 54 + { 55 + config: createConfig({ 49 56 input: 'additional-properties-true.json', 50 57 output: 'additional-properties-true', 51 58 }),
+1 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.0.x/additional-properties-false/types.gen.ts
··· 4 4 foo: string; 5 5 }; 6 6 7 - export type Bar = Foo & { 8 - [key: string]: never; 9 - }; 7 + export type Bar = Foo & {}; 10 8 11 9 export type Baz = Foo & { 12 10 bar: string;
+1 -3
packages/openapi-ts-tests/main/test/__snapshots__/3.1.x/additional-properties-false/types.gen.ts
··· 4 4 foo: string; 5 5 }; 6 6 7 - export type Bar = Foo & { 8 - [key: string]: never; 9 - }; 7 + export type Bar = Foo & {}; 10 8 11 9 export type Baz = Foo & { 12 10 bar: string;
+47
packages/openapi-ts-tests/specs/2.0.x/additional-properties-false.json
··· 1 + { 2 + "swagger": "2.0", 3 + "info": { 4 + "title": "OpenAPI 2.0 additional properties false example", 5 + "version": "1" 6 + }, 7 + "definitions": { 8 + "Foo": { 9 + "required": ["foo"], 10 + "type": "object", 11 + "properties": { 12 + "foo": { 13 + "type": "string" 14 + } 15 + }, 16 + "additionalProperties": false 17 + }, 18 + "Bar": { 19 + "allOf": [ 20 + { 21 + "$ref": "#/definitions/Foo" 22 + }, 23 + { 24 + "type": "object", 25 + "additionalProperties": false 26 + } 27 + ] 28 + }, 29 + "Baz": { 30 + "allOf": [ 31 + { 32 + "$ref": "#/definitions/Foo" 33 + }, 34 + { 35 + "required": ["bar"], 36 + "type": "object", 37 + "properties": { 38 + "bar": { 39 + "type": "string" 40 + } 41 + }, 42 + "additionalProperties": false 43 + } 44 + ] 45 + } 46 + } 47 + }
+2
packages/openapi-ts-tests/test/__snapshots__/2.0.x/additional-properties-false/index.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + export * from './types.gen';
+15
packages/openapi-ts-tests/test/__snapshots__/2.0.x/additional-properties-false/types.gen.ts
··· 1 + // This file is auto-generated by @hey-api/openapi-ts 2 + 3 + export type Foo = { 4 + foo: string; 5 + }; 6 + 7 + export type Bar = Foo & {}; 8 + 9 + export type Baz = Foo & { 10 + bar: string; 11 + }; 12 + 13 + export type ClientOptions = { 14 + baseUrl: string; 15 + };