diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index 767a2a7b..f2cf4329 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -310,7 +310,6 @@ export { EnumFromDescription } from './models/EnumFromDescription'; export { EnumWithExtensions } from './models/EnumWithExtensions'; export { EnumWithNumbers } from './models/EnumWithNumbers'; export { EnumWithStrings } from './models/EnumWithStrings'; -export type { ModelLink } from './models/ModelLink'; export type { ModelThatExtends } from './models/ModelThatExtends'; export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; export type { ModelWithArray } from './models/ModelWithArray'; @@ -322,7 +321,6 @@ export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicatePr export { ModelWithEnum } from './models/ModelWithEnum'; export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithLink } from './models/ModelWithLink'; export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; export type { ModelWithNullableString } from './models/ModelWithNullableString'; @@ -355,7 +353,6 @@ export { $EnumFromDescription } from './schemas/$EnumFromDescription'; export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; export { $EnumWithStrings } from './schemas/$EnumWithStrings'; -export { $ModelLink } from './schemas/$ModelLink'; export { $ModelThatExtends } from './schemas/$ModelThatExtends'; export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; export { $ModelWithArray } from './schemas/$ModelWithArray'; @@ -367,7 +364,6 @@ export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProp export { $ModelWithEnum } from './schemas/$ModelWithEnum'; export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; export { $ModelWithInteger } from './schemas/$ModelWithInteger'; -export { $ModelWithLink } from './schemas/$ModelWithLink'; export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; export { $ModelWithNullableString } from './schemas/$ModelWithNullableString'; @@ -610,20 +606,6 @@ export enum EnumWithStrings { }" `; -exports[`v2 should generate: ./test/generated/v2/models/ModelLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * This is a model that can have a template?? - */ -export type ModelLink = { - id?: string; -} -" -`; - exports[`v2 should generate: ./test/generated/v2/models/ModelThatExtends.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -849,23 +831,6 @@ export type ModelWithInteger = { " `; -exports[`v2 should generate: ./test/generated/v2/models/ModelWithLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelLink } from './ModelLink'; -import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model that can have a template?? - */ -export type ModelWithLink = { - prop?: ModelLink; -} -" -`; - exports[`v2 should generate: ./test/generated/v2/models/ModelWithNestedEnums.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -1295,19 +1260,6 @@ export const $EnumWithStrings = { };" `; -exports[`v2 should generate: ./test/generated/v2/schemas/$ModelLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ModelLink = { - properties: { - id: { - type: 'string', - }, - }, -};" -`; - exports[`v2 should generate: ./test/generated/v2/schemas/$ModelThatExtends.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -1496,19 +1448,6 @@ export const $ModelWithInteger = { };" `; -exports[`v2 should generate: ./test/generated/v2/schemas/$ModelWithLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ModelWithLink = { - properties: { - prop: { - type: 'ModelLink', - }, - }, -};" -`; - exports[`v2 should generate: ./test/generated/v2/schemas/$ModelWithNestedEnums.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -2618,7 +2557,6 @@ export { EnumFromDescription } from './models/EnumFromDescription'; export { EnumWithExtensions } from './models/EnumWithExtensions'; export { EnumWithNumbers } from './models/EnumWithNumbers'; export { EnumWithStrings } from './models/EnumWithStrings'; -export type { ModelLink } from './models/ModelLink'; export type { ModelThatExtends } from './models/ModelThatExtends'; export type { ModelThatExtendsExtends } from './models/ModelThatExtendsExtends'; export type { ModelWithArray } from './models/ModelWithArray'; @@ -2630,7 +2568,6 @@ export type { ModelWithDuplicateProperties } from './models/ModelWithDuplicatePr export { ModelWithEnum } from './models/ModelWithEnum'; export { ModelWithEnumFromDescription } from './models/ModelWithEnumFromDescription'; export type { ModelWithInteger } from './models/ModelWithInteger'; -export type { ModelWithLink } from './models/ModelWithLink'; export type { ModelWithNestedEnums } from './models/ModelWithNestedEnums'; export type { ModelWithNestedProperties } from './models/ModelWithNestedProperties'; export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; @@ -2668,7 +2605,6 @@ export { $EnumFromDescription } from './schemas/$EnumFromDescription'; export { $EnumWithExtensions } from './schemas/$EnumWithExtensions'; export { $EnumWithNumbers } from './schemas/$EnumWithNumbers'; export { $EnumWithStrings } from './schemas/$EnumWithStrings'; -export { $ModelLink } from './schemas/$ModelLink'; export { $ModelThatExtends } from './schemas/$ModelThatExtends'; export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; export { $ModelWithArray } from './schemas/$ModelWithArray'; @@ -2680,7 +2616,6 @@ export { $ModelWithDuplicateProperties } from './schemas/$ModelWithDuplicateProp export { $ModelWithEnum } from './schemas/$ModelWithEnum'; export { $ModelWithEnumFromDescription } from './schemas/$ModelWithEnumFromDescription'; export { $ModelWithInteger } from './schemas/$ModelWithInteger'; -export { $ModelWithLink } from './schemas/$ModelWithLink'; export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; @@ -3044,20 +2979,6 @@ export enum EnumWithStrings { }" `; -exports[`v3 should generate: ./test/generated/v3/models/ModelLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -/** - * This is a model that can have a template?? - */ -export type ModelLink = { - id?: string; -} -" -`; - exports[`v3 should generate: ./test/generated/v3/models/ModelThatExtends.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -3283,23 +3204,6 @@ export type ModelWithInteger = { " `; -exports[`v3 should generate: ./test/generated/v3/models/ModelWithLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelLink } from './ModelLink'; -import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model that can have a template?? - */ -export type ModelWithLink = { - prop?: ModelLink; -} -" -`; - exports[`v3 should generate: ./test/generated/v3/models/ModelWithNestedEnums.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -3875,19 +3779,6 @@ export const $EnumWithStrings = { };" `; -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ModelLink = { - properties: { - id: { - type: 'string', - }, - }, -};" -`; - exports[`v3 should generate: ./test/generated/v3/schemas/$ModelThatExtends.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -4076,19 +3967,6 @@ export const $ModelWithInteger = { };" `; -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithLink.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ -export const $ModelWithLink = { - properties: { - prop: { - type: 'ModelLink', - }, - }, -};" -`; - exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithNestedEnums.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ diff --git a/test/index.js b/test/index.js index 7c88334b..115c033c 100644 --- a/test/index.js +++ b/test/index.js @@ -7,8 +7,8 @@ async function generateV2() { input: './test/spec/v2.json', output: './test/generated/v2/', httpClient: OpenAPI.HttpClient.FETCH, - useOptions: false, - useUnionTypes: false, + useOptions: true, + useUnionTypes: true, exportCore: true, exportSchemas: true, exportModels: true, @@ -21,8 +21,8 @@ async function generateV3() { input: './test/spec/v3.json', output: './test/generated/v3/', httpClient: OpenAPI.HttpClient.FETCH, - useOptions: false, - useUnionTypes: false, + useOptions: true, + useUnionTypes: true, exportCore: true, exportSchemas: true, exportModels: true, diff --git a/test/spec/v2.json b/test/spec/v2.json index b5b39cdd..d0762044 100644 --- a/test/spec/v2.json +++ b/test/spec/v2.json @@ -1030,24 +1030,6 @@ } } }, - "ModelLink": { - "description": "This is a model that can have a template??", - "type": "object", - "properties": { - "id": { - "type": "string" - } - } - }, - "ModelWithLink": { - "description": "This is a model that can have a template??", - "type": "object", - "properties": { - "prop": { - "$ref": "#/definitions/ModelLink[ModelWithString]" - } - } - }, "ModelWithCircularReference": { "description": "This is a model with one property containing a circular reference", "type": "object", diff --git a/test/spec/v3.json b/test/spec/v3.json index 726df9c1..6f20181f 100644 --- a/test/spec/v3.json +++ b/test/spec/v3.json @@ -1488,24 +1488,6 @@ } } }, - "ModelLink": { - "description": "This is a model that can have a template??", - "type": "object", - "properties": { - "id": { - "type": "string" - } - } - }, - "ModelWithLink": { - "description": "This is a model that can have a template??", - "type": "object", - "properties": { - "prop": { - "$ref": "#/components/schemas/ModelLink[ModelWithString]" - } - } - }, "ModelWithCircularReference": { "description": "This is a model with one property containing a circular reference", "type": "object",