Skip to content

Commit 1830f73

Browse files
committed
- Removed old link method
1 parent 3978a30 commit 1830f73

File tree

4 files changed

+4
-162
lines changed

4 files changed

+4
-162
lines changed

test/__snapshots__/index.spec.js.snap

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,6 @@ export { EnumFromDescription } from './models/EnumFromDescription';
310310
export { EnumWithExtensions } from './models/EnumWithExtensions';
311311
export { EnumWithNumbers } from './models/EnumWithNumbers';
312312
export { EnumWithStrings } from './models/EnumWithStrings';
313-
export type { ModelLink } from './models/ModelLink';
314313
export type { ModelThatExtends } from './models/ModelThatExtends';
315314
export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends';
316315
export type { ModelWithArray } from './models/ModelWithArray';
@@ -322,7 +321,6 @@ export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicatePr
322321
export { ModelWithEnum } from './models/ModelWithEnum';
323322
export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription';
324323
export type { ModelWithInteger } from './models/ModelWithInteger';
325-
export type { ModelWithLink } from './models/ModelWithLink';
326324
export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums';
327325
export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties';
328326
export type { ModelWithNullableString } from './models/ModelWithNullableString';
@@ -355,7 +353,6 @@ export { $EnumFromDescription } from './schemas/$EnumFromDescription';
355353
export { $EnumWithExtensions } from './schemas/$EnumWithExtensions';
356354
export { $EnumWithNumbers } from './schemas/$EnumWithNumbers';
357355
export { $EnumWithStrings } from './schemas/$EnumWithStrings';
358-
export { $ModelLink } from './schemas/$ModelLink';
359356
export { $ModelThatExtends } from './schemas/$ModelThatExtends';
360357
export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends';
361358
export { $ModelWithArray } from './schemas/$ModelWithArray';
@@ -367,7 +364,6 @@ export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProp
367364
export { $ModelWithEnum } from './schemas/$ModelWithEnum';
368365
export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription';
369366
export { $ModelWithInteger } from './schemas/$ModelWithInteger';
370-
export { $ModelWithLink } from './schemas/$ModelWithLink';
371367
export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums';
372368
export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties';
373369
export { $ModelWithNullableString } from './schemas/$ModelWithNullableString';
@@ -610,20 +606,6 @@ export enum EnumWithStrings {
610606
}"
611607
`;
612608

613-
exports[`v2 should generate: ./test/generated/v2/models/ModelLink.ts 1`] = `
614-
"/* istanbul ignore file */
615-
/* tslint:disable */
616-
/* eslint-disable */
617-
618-
/**
619-
* This is a model that can have a template??
620-
*/
621-
export type ModelLink = {
622-
id?: string;
623-
}
624-
"
625-
`;
626-
627609
exports[`v2 should generate: ./test/generated/v2/models/ModelThatExtends.ts 1`] = `
628610
"/* istanbul ignore file */
629611
/* tslint:disable */
@@ -849,23 +831,6 @@ export type ModelWithInteger = {
849831
"
850832
`;
851833

852-
exports[`v2 should generate: ./test/generated/v2/models/ModelWithLink.ts 1`] = `
853-
"/* istanbul ignore file */
854-
/* tslint:disable */
855-
/* eslint-disable */
856-
857-
import type { ModelLink } from './ModelLink';
858-
import type { ModelWithString } from './ModelWithString';
859-
860-
/**
861-
* This is a model that can have a template??
862-
*/
863-
export type ModelWithLink = {
864-
prop?: ModelLink;
865-
}
866-
"
867-
`;
868-
869834
exports[`v2 should generate: ./test/generated/v2/models/ModelWithNestedEnums.ts 1`] = `
870835
"/* istanbul ignore file */
871836
/* tslint:disable */
@@ -1295,19 +1260,6 @@ export const $EnumWithStrings = {
12951260
};"
12961261
`;
12971262

1298-
exports[`v2 should generate: ./test/generated/v2/schemas/$ModelLink.ts 1`] = `
1299-
"/* istanbul ignore file */
1300-
/* tslint:disable */
1301-
/* eslint-disable */
1302-
export const $ModelLink = {
1303-
properties: {
1304-
id: {
1305-
type: 'string',
1306-
},
1307-
},
1308-
};"
1309-
`;
1310-
13111263
exports[`v2 should generate: ./test/generated/v2/schemas/$ModelThatExtends.ts 1`] = `
13121264
"/* istanbul ignore file */
13131265
/* tslint:disable */
@@ -1496,19 +1448,6 @@ export const $ModelWithInteger = {
14961448
};"
14971449
`;
14981450

1499-
exports[`v2 should generate: ./test/generated/v2/schemas/$ModelWithLink.ts 1`] = `
1500-
"/* istanbul ignore file */
1501-
/* tslint:disable */
1502-
/* eslint-disable */
1503-
export const $ModelWithLink = {
1504-
properties: {
1505-
prop: {
1506-
type: 'ModelLink',
1507-
},
1508-
},
1509-
};"
1510-
`;
1511-
15121451
exports[`v2 should generate: ./test/generated/v2/schemas/$ModelWithNestedEnums.ts 1`] = `
15131452
"/* istanbul ignore file */
15141453
/* tslint:disable */
@@ -2618,7 +2557,6 @@ export { EnumFromDescription } from './models/EnumFromDescription';
26182557
export { EnumWithExtensions } from './models/EnumWithExtensions';
26192558
export { EnumWithNumbers } from './models/EnumWithNumbers';
26202559
export { EnumWithStrings } from './models/EnumWithStrings';
2621-
export type { ModelLink } from './models/ModelLink';
26222560
export type { ModelThatExtends } from './models/ModelThatExtends';
26232561
export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends';
26242562
export type { ModelWithArray } from './models/ModelWithArray';
@@ -2630,7 +2568,6 @@ export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicatePr
26302568
export { ModelWithEnum } from './models/ModelWithEnum';
26312569
export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription';
26322570
export type { ModelWithInteger } from './models/ModelWithInteger';
2633-
export type { ModelWithLink } from './models/ModelWithLink';
26342571
export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums';
26352572
export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties';
26362573
export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties';
@@ -2668,7 +2605,6 @@ export { $EnumFromDescription } from './schemas/$EnumFromDescription';
26682605
export { $EnumWithExtensions } from './schemas/$EnumWithExtensions';
26692606
export { $EnumWithNumbers } from './schemas/$EnumWithNumbers';
26702607
export { $EnumWithStrings } from './schemas/$EnumWithStrings';
2671-
export { $ModelLink } from './schemas/$ModelLink';
26722608
export { $ModelThatExtends } from './schemas/$ModelThatExtends';
26732609
export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends';
26742610
export { $ModelWithArray } from './schemas/$ModelWithArray';
@@ -2680,7 +2616,6 @@ export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProp
26802616
export { $ModelWithEnum } from './schemas/$ModelWithEnum';
26812617
export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription';
26822618
export { $ModelWithInteger } from './schemas/$ModelWithInteger';
2683-
export { $ModelWithLink } from './schemas/$ModelWithLink';
26842619
export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums';
26852620
export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties';
26862621
export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties';
@@ -3044,20 +2979,6 @@ export enum EnumWithStrings {
30442979
}"
30452980
`;
30462981

3047-
exports[`v3 should generate: ./test/generated/v3/models/ModelLink.ts 1`] = `
3048-
"/* istanbul ignore file */
3049-
/* tslint:disable */
3050-
/* eslint-disable */
3051-
3052-
/**
3053-
* This is a model that can have a template??
3054-
*/
3055-
export type ModelLink = {
3056-
id?: string;
3057-
}
3058-
"
3059-
`;
3060-
30612982
exports[`v3 should generate: ./test/generated/v3/models/ModelThatExtends.ts 1`] = `
30622983
"/* istanbul ignore file */
30632984
/* tslint:disable */
@@ -3283,23 +3204,6 @@ export type ModelWithInteger = {
32833204
"
32843205
`;
32853206

3286-
exports[`v3 should generate: ./test/generated/v3/models/ModelWithLink.ts 1`] = `
3287-
"/* istanbul ignore file */
3288-
/* tslint:disable */
3289-
/* eslint-disable */
3290-
3291-
import type { ModelLink } from './ModelLink';
3292-
import type { ModelWithString } from './ModelWithString';
3293-
3294-
/**
3295-
* This is a model that can have a template??
3296-
*/
3297-
export type ModelWithLink = {
3298-
prop?: ModelLink;
3299-
}
3300-
"
3301-
`;
3302-
33033207
exports[`v3 should generate: ./test/generated/v3/models/ModelWithNestedEnums.ts 1`] = `
33043208
"/* istanbul ignore file */
33053209
/* tslint:disable */
@@ -3875,19 +3779,6 @@ export const $EnumWithStrings = {
38753779
};"
38763780
`;
38773781

3878-
exports[`v3 should generate: ./test/generated/v3/schemas/$ModelLink.ts 1`] = `
3879-
"/* istanbul ignore file */
3880-
/* tslint:disable */
3881-
/* eslint-disable */
3882-
export const $ModelLink = {
3883-
properties: {
3884-
id: {
3885-
type: 'string',
3886-
},
3887-
},
3888-
};"
3889-
`;
3890-
38913782
exports[`v3 should generate: ./test/generated/v3/schemas/$ModelThatExtends.ts 1`] = `
38923783
"/* istanbul ignore file */
38933784
/* tslint:disable */
@@ -4076,19 +3967,6 @@ export const $ModelWithInteger = {
40763967
};"
40773968
`;
40783969

4079-
exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithLink.ts 1`] = `
4080-
"/* istanbul ignore file */
4081-
/* tslint:disable */
4082-
/* eslint-disable */
4083-
export const $ModelWithLink = {
4084-
properties: {
4085-
prop: {
4086-
type: 'ModelLink',
4087-
},
4088-
},
4089-
};"
4090-
`;
4091-
40923970
exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithNestedEnums.ts 1`] = `
40933971
"/* istanbul ignore file */
40943972
/* tslint:disable */

test/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ async function generateV2() {
77
input: './test/spec/v2.json',
88
output: './test/generated/v2/',
99
httpClient: OpenAPI.HttpClient.FETCH,
10-
useOptions: false,
11-
useUnionTypes: false,
10+
useOptions: true,
11+
useUnionTypes: true,
1212
exportCore: true,
1313
exportSchemas: true,
1414
exportModels: true,
@@ -21,8 +21,8 @@ async function generateV3() {
2121
input: './test/spec/v3.json',
2222
output: './test/generated/v3/',
2323
httpClient: OpenAPI.HttpClient.FETCH,
24-
useOptions: false,
25-
useUnionTypes: false,
24+
useOptions: true,
25+
useUnionTypes: true,
2626
exportCore: true,
2727
exportSchemas: true,
2828
exportModels: true,

test/spec/v2.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,24 +1030,6 @@
10301030
}
10311031
}
10321032
},
1033-
"ModelLink": {
1034-
"description": "This is a model that can have a template??",
1035-
"type": "object",
1036-
"properties": {
1037-
"id": {
1038-
"type": "string"
1039-
}
1040-
}
1041-
},
1042-
"ModelWithLink": {
1043-
"description": "This is a model that can have a template??",
1044-
"type": "object",
1045-
"properties": {
1046-
"prop": {
1047-
"$ref": "#/definitions/ModelLink[ModelWithString]"
1048-
}
1049-
}
1050-
},
10511033
"ModelWithCircularReference": {
10521034
"description": "This is a model with one property containing a circular reference",
10531035
"type": "object",

test/spec/v3.json

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1488,24 +1488,6 @@
14881488
}
14891489
}
14901490
},
1491-
"ModelLink": {
1492-
"description": "This is a model that can have a template??",
1493-
"type": "object",
1494-
"properties": {
1495-
"id": {
1496-
"type": "string"
1497-
}
1498-
}
1499-
},
1500-
"ModelWithLink": {
1501-
"description": "This is a model that can have a template??",
1502-
"type": "object",
1503-
"properties": {
1504-
"prop": {
1505-
"$ref": "#/components/schemas/ModelLink[ModelWithString]"
1506-
}
1507-
}
1508-
},
15091491
"ModelWithCircularReference": {
15101492
"description": "This is a model with one property containing a circular reference",
15111493
"type": "object",

0 commit comments

Comments
 (0)