diff --git a/src/openApi/v3/parser/getModel.ts b/src/openApi/v3/parser/getModel.ts index 19f54baa..5c3a22aa 100644 --- a/src/openApi/v3/parser/getModel.ts +++ b/src/openApi/v3/parser/getModel.ts @@ -103,7 +103,7 @@ export function getModel(openApi: OpenApi, definition: OpenApiSchema, isDefiniti } } - if (definition.type === 'object' && typeof definition.additionalProperties === 'object') { + if (definition.type === 'object' && definition.additionalProperties && typeof definition.additionalProperties === 'object') { if (definition.additionalProperties.$ref) { const additionalProperties = getType(definition.additionalProperties.$ref); model.export = 'dictionary'; diff --git a/src/templates/partials/schemaComposition.hbs b/src/templates/partials/schemaComposition.hbs index 46953c1e..8840ce2a 100644 --- a/src/templates/partials/schemaComposition.hbs +++ b/src/templates/partials/schemaComposition.hbs @@ -1,6 +1,5 @@ { type: '{{export}}', - contains: [{{#each properties}}{{>schema}}, {{/each}}] {{#if isReadOnly}} isReadOnly: {{{isReadOnly}}}, diff --git a/src/templates/partials/typeIntersection.hbs b/src/templates/partials/typeIntersection.hbs index 0e4af219..d966489f 100644 --- a/src/templates/partials/typeIntersection.hbs +++ b/src/templates/partials/typeIntersection.hbs @@ -1 +1 @@ -({{#each properties}}{{#unless @first}} & {{/unless}}{{>type}}{{/each}}){{>isNullable}} +({{#each properties}}{{>type}}{{#unless @last}} & {{/unless}}{{/each}}){{>isNullable}} diff --git a/src/templates/partials/typeUnion.hbs b/src/templates/partials/typeUnion.hbs index 13c71eeb..b2561f52 100644 --- a/src/templates/partials/typeUnion.hbs +++ b/src/templates/partials/typeUnion.hbs @@ -1 +1 @@ -({{#each properties}}{{#unless @first}} | {{/unless}}{{>type}}{{/each}}){{>isNullable}} +({{#each properties}}{{>type}}{{#unless @last}} | {{/unless}}{{/each}}){{>isNullable}} diff --git a/test/__snapshots__/index.spec.js.snap b/test/__snapshots__/index.spec.js.snap index fd28a17a..42b24b66 100644 --- a/test/__snapshots__/index.spec.js.snap +++ b/test/__snapshots__/index.spec.js.snap @@ -2644,7 +2644,13 @@ export type { ArrayWithNumbers } from './models/ArrayWithNumbers'; export type { ArrayWithProperties } from './models/ArrayWithProperties'; export type { ArrayWithReferences } from './models/ArrayWithReferences'; export type { ArrayWithStrings } from './models/ArrayWithStrings'; -export type { Date } from './models/Date'; +export type { CompositionWithAllOfAndNullable } from './models/CompositionWithAllOfAndNullable'; +export type { CompositionWithAnyOf } from './models/CompositionWithAnyOf'; +export type { CompositionWithAnyOfAndNullable } from './models/CompositionWithAnyOfAndNullable'; +export type { CompositionWithAnyOfAnonymous } from './models/CompositionWithAnyOfAnonymous'; +export type { CompositionWithOneOf } from './models/CompositionWithOneOf'; +export type { CompositionWithOneOfAndNullable } from './models/CompositionWithOneOfAndNullable'; +export type { CompositionWithOneOfAnonymous } from './models/CompositionWithOneOfAnonymous'; export type { DictionaryWithArray } from './models/DictionaryWithArray'; export type { DictionaryWithDictionary } from './models/DictionaryWithDictionary'; export type { DictionaryWithProperties } from './models/DictionaryWithProperties'; @@ -2657,9 +2663,6 @@ 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 { ModelWithAllOfAndNullable } from './models/ModelWithAllOfAndNullable'; -export type { ModelWithAnyOf } from './models/ModelWithAnyOf'; -export type { ModelWithAnyOfAndNullable } from './models/ModelWithAnyOfAndNullable'; export type { ModelWithArray } from './models/ModelWithArray'; export type { ModelWithBoolean } from './models/ModelWithBoolean'; export type { ModelWithCircularReference } from './models/ModelWithCircularReference'; @@ -2672,8 +2675,6 @@ 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 { ModelWithOneOf } from './models/ModelWithOneOf'; -export type { ModelWithOneOfAndNullable } from './models/ModelWithOneOfAndNullable'; export type { ModelWithOrderedProperties } from './models/ModelWithOrderedProperties'; export type { ModelWithPattern } from './models/ModelWithPattern'; export type { ModelWithProperties } from './models/ModelWithProperties'; @@ -2693,7 +2694,13 @@ export { $ArrayWithNumbers } from './schemas/$ArrayWithNumbers'; export { $ArrayWithProperties } from './schemas/$ArrayWithProperties'; export { $ArrayWithReferences } from './schemas/$ArrayWithReferences'; export { $ArrayWithStrings } from './schemas/$ArrayWithStrings'; -export { $Date } from './schemas/$Date'; +export { $CompositionWithAllOfAndNullable } from './schemas/$CompositionWithAllOfAndNullable'; +export { $CompositionWithAnyOf } from './schemas/$CompositionWithAnyOf'; +export { $CompositionWithAnyOfAndNullable } from './schemas/$CompositionWithAnyOfAndNullable'; +export { $CompositionWithAnyOfAnonymous } from './schemas/$CompositionWithAnyOfAnonymous'; +export { $CompositionWithOneOf } from './schemas/$CompositionWithOneOf'; +export { $CompositionWithOneOfAndNullable } from './schemas/$CompositionWithOneOfAndNullable'; +export { $CompositionWithOneOfAnonymous } from './schemas/$CompositionWithOneOfAnonymous'; export { $DictionaryWithArray } from './schemas/$DictionaryWithArray'; export { $DictionaryWithDictionary } from './schemas/$DictionaryWithDictionary'; export { $DictionaryWithProperties } from './schemas/$DictionaryWithProperties'; @@ -2706,9 +2713,6 @@ export { $EnumWithStrings } from './schemas/$EnumWithStrings'; export { $ModelLink } from './schemas/$ModelLink'; export { $ModelThatExtends } from './schemas/$ModelThatExtends'; export { $ModelThatExtendsExtends } from './schemas/$ModelThatExtendsExtends'; -export { $ModelWithAllOfAndNullable } from './schemas/$ModelWithAllOfAndNullable'; -export { $ModelWithAnyOf } from './schemas/$ModelWithAnyOf'; -export { $ModelWithAnyOfAndNullable } from './schemas/$ModelWithAnyOfAndNullable'; export { $ModelWithArray } from './schemas/$ModelWithArray'; export { $ModelWithBoolean } from './schemas/$ModelWithBoolean'; export { $ModelWithCircularReference } from './schemas/$ModelWithCircularReference'; @@ -2721,8 +2725,6 @@ export { $ModelWithInteger } from './schemas/$ModelWithInteger'; export { $ModelWithLink } from './schemas/$ModelWithLink'; export { $ModelWithNestedEnums } from './schemas/$ModelWithNestedEnums'; export { $ModelWithNestedProperties } from './schemas/$ModelWithNestedProperties'; -export { $ModelWithOneOf } from './schemas/$ModelWithOneOf'; -export { $ModelWithOneOfAndNullable } from './schemas/$ModelWithOneOfAndNullable'; export { $ModelWithOrderedProperties } from './schemas/$ModelWithOrderedProperties'; export { $ModelWithPattern } from './schemas/$ModelWithPattern'; export { $ModelWithProperties } from './schemas/$ModelWithProperties'; @@ -2823,15 +2825,134 @@ exports[`v3 should generate: ./test/generated/v3/models/ArrayWithStrings.ts 1`] export type ArrayWithStrings = Array;" `; -exports[`v3 should generate: ./test/generated/v3/models/Date.ts 1`] = ` +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithAllOfAndNullable.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'all of' relationship + */ +export interface CompositionWithAllOfAndNullable { + propA?: ({ + boolean?: boolean, + } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithAnyOf.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one property with a 'any of' relationship + */ +export interface CompositionWithAnyOf { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithAnyOfAndNullable.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'any of' relationship + */ +export interface CompositionWithAnyOfAndNullable { + propA?: ({ + boolean?: boolean, + } | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null; +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithAnyOfAnonymous.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ /** - * This is a type-only model that defines Date as a string + * This is a model with one property with a 'any of' relationship where the options are not $ref */ -export type Date = string;" +export interface CompositionWithAnyOfAnonymous { + propA?: ({ + propA?: any, + } | string | number); +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithOneOf.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; +import type { ModelWithString } from './ModelWithString'; + +/** + * This is a model with one property with a 'one of' relationship + */ +export interface CompositionWithOneOf { + propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithOneOfAndNullable.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +import type { ModelWithArray } from './ModelWithArray'; +import type { ModelWithDictionary } from './ModelWithDictionary'; +import type { ModelWithEnum } from './ModelWithEnum'; + +/** + * This is a model with one property with a 'one of' relationship + */ +export interface CompositionWithOneOfAndNullable { + propA?: ({ + boolean?: boolean, + } | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null; +} +" +`; + +exports[`v3 should generate: ./test/generated/v3/models/CompositionWithOneOfAnonymous.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +/** + * This is a model with one property with a 'one of' relationship where the options are not $ref + */ +export interface CompositionWithOneOfAnonymous { + propA?: ({ + propA?: any, + } | string | number); +} +" `; exports[`v3 should generate: ./test/generated/v3/models/DictionaryWithArray.ts 1`] = ` @@ -3012,65 +3133,6 @@ export type ModelThatExtendsExtends = (ModelWithString & ModelThatExtends & { });" `; -exports[`v3 should generate: ./test/generated/v3/models/ModelWithAllOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelWithArray } from './ModelWithArray'; -import type { ModelWithDictionary } from './ModelWithDictionary'; -import type { ModelWithEnum } from './ModelWithEnum'; - -/** - * This is a model with one property with a 'all of' relationship - */ -export interface ModelWithAllOfAndNullable { - propA?: ({ - boolean?: boolean, - } & ModelWithEnum & ModelWithArray & ModelWithDictionary) | null; -} -" -`; - -exports[`v3 should generate: ./test/generated/v3/models/ModelWithAnyOf.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelWithArray } from './ModelWithArray'; -import type { ModelWithDictionary } from './ModelWithDictionary'; -import type { ModelWithEnum } from './ModelWithEnum'; -import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with one property with a 'any of' relationship - */ -export interface ModelWithAnyOf { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -} -" -`; - -exports[`v3 should generate: ./test/generated/v3/models/ModelWithAnyOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelWithArray } from './ModelWithArray'; -import type { ModelWithDictionary } from './ModelWithDictionary'; -import type { ModelWithEnum } from './ModelWithEnum'; - -/** - * This is a model with one property with a 'any of' relationship - */ -export interface ModelWithAnyOfAndNullable { - propA?: ({ - boolean?: boolean, - } | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null; -} -" -`; - exports[`v3 should generate: ./test/generated/v3/models/ModelWithArray.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -3315,45 +3377,6 @@ export interface ModelWithNestedProperties { " `; -exports[`v3 should generate: ./test/generated/v3/models/ModelWithOneOf.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelWithArray } from './ModelWithArray'; -import type { ModelWithDictionary } from './ModelWithDictionary'; -import type { ModelWithEnum } from './ModelWithEnum'; -import type { ModelWithString } from './ModelWithString'; - -/** - * This is a model with one property with a 'one of' relationship - */ -export interface ModelWithOneOf { - propA?: (ModelWithString | ModelWithEnum | ModelWithArray | ModelWithDictionary); -} -" -`; - -exports[`v3 should generate: ./test/generated/v3/models/ModelWithOneOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -import type { ModelWithArray } from './ModelWithArray'; -import type { ModelWithDictionary } from './ModelWithDictionary'; -import type { ModelWithEnum } from './ModelWithEnum'; - -/** - * This is a model with one property with a 'one of' relationship - */ -export interface ModelWithOneOfAndNullable { - propA?: ({ - boolean?: boolean, - } | ModelWithEnum | ModelWithArray | ModelWithDictionary) | null; -} -" -`; - exports[`v3 should generate: ./test/generated/v3/models/ModelWithOrderedProperties.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -3616,13 +3639,185 @@ export const $ArrayWithStrings = { };" `; -exports[`v3 should generate: ./test/generated/v3/schemas/$Date.ts 1`] = ` +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithAllOfAndNullable.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ /* eslint-disable */ -export const $Date = { - type: 'string', +export const $CompositionWithAllOfAndNullable = { + properties: { + propA: { + type: 'all-of', + contains: [{ + properties: { + boolean: { + type: 'boolean', + }, + }, + }, { + type: 'ModelWithEnum', + }, { + type: 'ModelWithArray', + }, { + type: 'ModelWithDictionary', + }, ] + isNullable: true, + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithAnyOf.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithAnyOf = { + properties: { + propA: { + type: 'any-of', + contains: [{ + type: 'ModelWithString', + }, { + type: 'ModelWithEnum', + }, { + type: 'ModelWithArray', + }, { + type: 'ModelWithDictionary', + }, ] + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithAnyOfAndNullable.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithAnyOfAndNullable = { + properties: { + propA: { + type: 'any-of', + contains: [{ + properties: { + boolean: { + type: 'boolean', + }, + }, + }, { + type: 'ModelWithEnum', + }, { + type: 'ModelWithArray', + }, { + type: 'ModelWithDictionary', + }, ] + isNullable: true, + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithAnyOfAnonymous.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithAnyOfAnonymous = { + properties: { + propA: { + type: 'any-of', + contains: [{ + properties: { + propA: { + properties: { + }, + }, + }, + }, { + type: 'string', + }, { + type: 'number', + }, ] + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithOneOf.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithOneOf = { + properties: { + propA: { + type: 'one-of', + contains: [{ + type: 'ModelWithString', + }, { + type: 'ModelWithEnum', + }, { + type: 'ModelWithArray', + }, { + type: 'ModelWithDictionary', + }, ] + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithOneOfAndNullable.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithOneOfAndNullable = { + properties: { + propA: { + type: 'one-of', + contains: [{ + properties: { + boolean: { + type: 'boolean', + }, + }, + }, { + type: 'ModelWithEnum', + }, { + type: 'ModelWithArray', + }, { + type: 'ModelWithDictionary', + }, ] + isNullable: true, + }, + }, +};" +`; + +exports[`v3 should generate: ./test/generated/v3/schemas/$CompositionWithOneOfAnonymous.ts 1`] = ` +"/* istanbul ignore file */ +/* tslint:disable */ +/* eslint-disable */ + +export const $CompositionWithOneOfAnonymous = { + properties: { + propA: { + type: 'one-of', + contains: [{ + properties: { + propA: { + properties: { + }, + }, + }, + }, { + type: 'string', + }, { + type: 'number', + }, ] + }, + }, };" `; @@ -3765,7 +3960,6 @@ exports[`v3 should generate: ./test/generated/v3/schemas/$ModelThatExtends.ts 1` export const $ModelThatExtends = { type: 'all-of', - contains: [{ type: 'ModelWithString', }, { @@ -3788,7 +3982,6 @@ exports[`v3 should generate: ./test/generated/v3/schemas/$ModelThatExtendsExtend export const $ModelThatExtendsExtends = { type: 'all-of', - contains: [{ type: 'ModelWithString', }, { @@ -3806,88 +3999,6 @@ export const $ModelThatExtendsExtends = { };" `; -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithAllOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export const $ModelWithAllOfAndNullable = { - properties: { - propA: { - type: 'all-of', - - contains: [{ - properties: { - boolean: { - type: 'boolean', - }, - }, - }, { - type: 'ModelWithEnum', - }, { - type: 'ModelWithArray', - }, { - type: 'ModelWithDictionary', - }, ] - isNullable: true, - }, - }, -};" -`; - -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithAnyOf.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export const $ModelWithAnyOf = { - properties: { - propA: { - type: 'any-of', - - contains: [{ - type: 'ModelWithString', - }, { - type: 'ModelWithEnum', - }, { - type: 'ModelWithArray', - }, { - type: 'ModelWithDictionary', - }, ] - }, - }, -};" -`; - -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithAnyOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export const $ModelWithAnyOfAndNullable = { - properties: { - propA: { - type: 'any-of', - - contains: [{ - properties: { - boolean: { - type: 'boolean', - }, - }, - }, { - type: 'ModelWithEnum', - }, { - type: 'ModelWithArray', - }, { - type: 'ModelWithDictionary', - }, ] - isNullable: true, - }, - }, -};" -`; - exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithArray.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ @@ -4121,59 +4232,6 @@ export const $ModelWithNestedProperties = { };" `; -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithOneOf.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export const $ModelWithOneOf = { - properties: { - propA: { - type: 'one-of', - - contains: [{ - type: 'ModelWithString', - }, { - type: 'ModelWithEnum', - }, { - type: 'ModelWithArray', - }, { - type: 'ModelWithDictionary', - }, ] - }, - }, -};" -`; - -exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithOneOfAndNullable.ts 1`] = ` -"/* istanbul ignore file */ -/* tslint:disable */ -/* eslint-disable */ - -export const $ModelWithOneOfAndNullable = { - properties: { - propA: { - type: 'one-of', - - contains: [{ - properties: { - boolean: { - type: 'boolean', - }, - }, - }, { - type: 'ModelWithEnum', - }, { - type: 'ModelWithArray', - }, { - type: 'ModelWithDictionary', - }, ] - isNullable: true, - }, - }, -};" -`; - exports[`v3 should generate: ./test/generated/v3/schemas/$ModelWithOrderedProperties.ts 1`] = ` "/* istanbul ignore file */ /* tslint:disable */ diff --git a/test/spec/v3.json b/test/spec/v3.json index bf2e552e..726df9c1 100644 --- a/test/spec/v3.json +++ b/test/spec/v3.json @@ -869,7 +869,7 @@ "in": "formData", "required": true, "schema": { - "type": "file" + "type": "File" } }, { @@ -1185,7 +1185,7 @@ }, "SimpleFile": { "description": "This is a simple file", - "type": "file" + "type": "File" }, "SimpleReference": { "description": "This is a simple reference", @@ -1338,10 +1338,6 @@ } } }, - "Date": { - "description": "This is a type-only model that defines Date as a string", - "type": "string" - }, "ModelWithInteger": { "description": "This is a model with one number property", "type": "object", @@ -1469,7 +1465,7 @@ "propWithFile": { "type": "array", "items": { - "type": "file" + "type": "File" } }, "propWithNumber": { @@ -1519,7 +1515,7 @@ } } }, - "ModelWithOneOf": { + "CompositionWithOneOf": { "description": "This is a model with one property with a 'one of' relationship", "type": "object", "properties": { @@ -1542,7 +1538,33 @@ } } }, - "ModelWithAnyOf": { + "CompositionWithOneOfAnonymous": { + "description": "This is a model with one property with a 'one of' relationship where the options are not $ref", + "type": "object", + "properties": { + "propA": { + "type": "object", + "oneOf": [ + { + "description": "Anonymous object type", + "type": "object", + "properties": { + "propA": "string" + } + }, + { + "description": "Anonymous string type", + "type": "string" + }, + { + "description": "Anonymous integer type", + "type": "integer" + } + ] + } + } + }, + "CompositionWithAnyOf": { "description": "This is a model with one property with a 'any of' relationship", "type": "object", "properties": { @@ -1565,7 +1587,33 @@ } } }, - "ModelWithOneOfAndNullable": { + "CompositionWithAnyOfAnonymous": { + "description": "This is a model with one property with a 'any of' relationship where the options are not $ref", + "type": "object", + "properties": { + "propA": { + "type": "object", + "anyOf": [ + { + "description": "Anonymous object type", + "type": "object", + "properties": { + "propA": "string" + } + }, + { + "description": "Anonymous string type", + "type": "string" + }, + { + "description": "Anonymous integer type", + "type": "integer" + } + ] + } + } + }, + "CompositionWithOneOfAndNullable": { "description": "This is a model with one property with a 'one of' relationship", "type": "object", "properties": { @@ -1594,7 +1642,7 @@ } } }, - "ModelWithAllOfAndNullable": { + "CompositionWithAllOfAndNullable": { "description": "This is a model with one property with a 'all of' relationship", "type": "object", "properties": { @@ -1623,7 +1671,7 @@ } } }, - "ModelWithAnyOfAndNullable": { + "CompositionWithAnyOfAndNullable": { "description": "This is a model with one property with a 'any of' relationship", "type": "object", "properties": {