diff --git a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js index 9559067c5b..daf8166ecc 100644 --- a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js +++ b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js @@ -7,6 +7,7 @@ import openApi3_1Namespace, { getNodeType, keyMap } from '@swagger-api/apidom-ns import OpenApi3_1SwaggerClientDereferenceVisitor from './visitors/dereference.js'; import ParameterMacroVisitor from './visitors/parameters.js'; import ModelPropertyMacroVisitor from './visitors/properties.js'; +import AllOfVisitor from './visitors/all-of.js'; const visitAsync = visit[Symbol.for('nodejs.util.promisify.custom')]; @@ -16,18 +17,21 @@ const OpenApi3_1SwaggerClientDereferenceStrategy = OpenApi3_1DereferenceStrategy allowMetaPatches: false, parameterMacro: null, modelPropertyMacro: null, + mode: 'non-strict', }, init({ useCircularStructures = this.useCircularStructures, allowMetaPatches = this.allowMetaPatches, parameterMacro = this.parameterMacro, modelPropertyMacro = this.modelPropertyMacro, + mode = this.mode, } = {}) { this.name = 'openapi-3-1-swagger-client'; this.useCircularStructures = useCircularStructures; this.allowMetaPatches = allowMetaPatches; this.parameterMacro = parameterMacro; this.modelPropertyMacro = modelPropertyMacro; + this.mode = mode; }, methods: { async dereference(file, options) { @@ -70,6 +74,12 @@ const OpenApi3_1SwaggerClientDereferenceStrategy = OpenApi3_1DereferenceStrategy visitors.push(modelPropertyMacroVisitor); } + // create allOf visitor (if necessary) + if (this.mode !== 'strict') { + const allOfVisitor = AllOfVisitor(); + visitors.push(allOfVisitor); + } + // determine the root visitor const rootVisitor = visitors.length === 1 diff --git a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/all-of.js b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/all-of.js new file mode 100644 index 0000000000..0e23bb7c60 --- /dev/null +++ b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/all-of.js @@ -0,0 +1,63 @@ +import { isArrayElement, deepmerge } from '@swagger-api/apidom-core'; +import { isSchemaElement, SchemaElement } from '@swagger-api/apidom-ns-openapi-3-1'; + +const AllOfVisitor = () => ({ + SchemaElement: { + leave(schemaElement) { + // do nothing + if (typeof schemaElement.allOf === 'undefined') return undefined; + // throw if allOf keyword is not an array + if (!isArrayElement(schemaElement.allOf)) { + throw new TypeError('allOf must be an array'); + } + // remove allOf keyword if empty + if (schemaElement.allOf.isEmpty) { + return new SchemaElement( + schemaElement.content.filter((memberElement) => memberElement.key.toValue() !== 'allOf'), + schemaElement.meta.clone(), + schemaElement.attributes.clone() + ); + } + // throw if allOf keyword contains anything else than Schema Object + schemaElement.allOf.forEach((item) => { + if (!isSchemaElement(item)) { + throw new TypeError('Elements in allOf must be objects'); + } + }); + + const mergedSchemaElement = deepmerge.all([...schemaElement.allOf.content, schemaElement]); + + /** + * If there was not an original $$ref value, make sure to remove + * any $$ref value that may exist from the result of `allOf` merges. + */ + if (!schemaElement.hasKey('$$ref')) { + mergedSchemaElement.remove('$$ref'); + } + + /** + * If there was an example keyword in the original definition, + * keep it instead of merging with example from other schema. + */ + if (schemaElement.hasKey('example')) { + const member = mergedSchemaElement.getMember('example'); + member.value = schemaElement.get('example'); + } + + /** + * If there was an examples keyword in the original definition, + * keep it instead of merging with examples from other schema. + */ + if (schemaElement.hasKey('examples')) { + const member = mergedSchemaElement.getMember('examples'); + member.value = schemaElement.get('examples'); + } + + // remove allOf keyword after the merge + mergedSchemaElement.remove('allOf'); + return mergedSchemaElement; + }, + }, +}); + +export default AllOfVisitor; diff --git a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js index ac529a144c..9e9cfad673 100644 --- a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js +++ b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/parameters.js @@ -13,7 +13,7 @@ const ParameterMacroVisitor = ({ parameterMacro }) => { }, }, ParameterElement: { - leave: (parameterElement) => { + leave(parameterElement) { const pojoOperation = macroOperation === null ? null : toValue(macroOperation); const pojoParameter = toValue(parameterElement); const defaultValue = parameterMacro(pojoOperation, pojoParameter); diff --git a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js index f0f392ce7b..8d97209894 100644 --- a/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js +++ b/src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/visitors/properties.js @@ -2,7 +2,7 @@ import { isObjectElement, toValue } from '@swagger-api/apidom-core'; const ModelPropertyMacroVisitor = ({ modelPropertyMacro }) => ({ SchemaElement: { - leave: (schemaElement) => { + leave(schemaElement) { if (typeof schemaElement.properties === 'undefined') return; if (!isObjectElement(schemaElement.properties)) return; diff --git a/src/resolver/strategies/openapi-3-1.js b/src/resolver/strategies/openapi-3-1.js index 5f95550ab5..82157ba99d 100644 --- a/src/resolver/strategies/openapi-3-1.js +++ b/src/resolver/strategies/openapi-3-1.js @@ -38,6 +38,7 @@ const resolveOpenAPI31Strategy = async (options) => { skipNormalization = false, parameterMacro = null, modelPropertyMacro = null, + mode = 'non-strict', } = options; try { // determining BaseURI @@ -101,6 +102,7 @@ const resolveOpenAPI31Strategy = async (options) => { useCircularStructures, parameterMacro, modelPropertyMacro, + mode, }), ], refSet, diff --git a/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/dereferenced.json b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/dereferenced.json index 6f9ffbff9a..453d4a6686 100644 --- a/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/dereferenced.json +++ b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/dereferenced.json @@ -13,6 +13,21 @@ }, "schema3": { "type": "object" + }, + "schema4": { + "type": "string" + }, + "Animal": { + "properties": { + "pet": { + "$$ref": "http://localhost:8123/root.json#/components/schemas/schema3", + "type": "object" + }, + "cat": { + "$$ref": "http://localhost:8123/root.json#/components/schemas/schema4", + "type": "string" + } + } } } } diff --git a/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/root.json b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/root.json index 3b107b785b..13ce2d4c03 100644 --- a/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/root.json +++ b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/__fixtures__/meta-patches-internal/root.json @@ -10,6 +10,19 @@ }, "schema3": { "type": "object" + }, + "schema4": { + "type": "string" + }, + "Animal": { + "properties": { + "pet": { + "$ref": "#/components/schemas/schema3" + }, + "cat": { + "$ref": "#/components/schemas/schema4" + } + } } } } diff --git a/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/all-of.js b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/all-of.js new file mode 100644 index 0000000000..56a667996b --- /dev/null +++ b/test/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/schema-object/all-of.js @@ -0,0 +1,872 @@ +/* eslint-disable camelcase */ +import { toValue } from '@swagger-api/apidom-core'; +import { mediaTypes, OpenApi3_1Element } from '@swagger-api/apidom-ns-openapi-3-1'; +import { + dereferenceApiDOM, + DereferenceError, +} from '@swagger-api/apidom-reference/configuration/empty'; + +import * as jestSetup from '../__utils__/jest.local.setup.js'; +import OpenApi3_1SwaggerClientDereferenceStrategy from '../../../../../../../../src/helpers/apidom/reference/dereference/strategies/openapi-3-1-swagger-client/index.js'; + +describe('dereference', () => { + beforeAll(() => { + jestSetup.beforeAll(); + }); + + afterAll(() => { + jestSetup.afterAll(); + }); + + describe('strategies', () => { + describe('openapi-3-1-swagger-client', () => { + describe('Schema Object', () => { + describe('given allOf is not an array', () => { + test('should throw error', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + allOf: {}, + }, + }, + }, + }); + const dereferenceThunk = () => + dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + await expect(dereferenceThunk()).rejects.toThrow(DereferenceError); + await expect(dereferenceThunk()).rejects.toMatchObject({ + cause: { + cause: { + message: expect.stringMatching(/^allOf must be an array$/), + }, + }, + }); + }); + }); + + describe('given allOf contains empty list', () => { + test('should remove the keyword from Schema Object', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + allOf: [], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + User: {}, + }, + }, + }); + }); + }); + + describe('give allOf contains non-object item', () => { + test('should throw error', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + allOf: [{ type: 'string' }, 2], + }, + }, + }, + }); + const dereferenceThunk = () => + dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + await expect(dereferenceThunk()).rejects.toThrow(DereferenceError); + await expect(dereferenceThunk()).rejects.toMatchObject({ + cause: { + cause: { + message: expect.stringMatching(/^Elements in allOf must be objects$/), + }, + }, + }); + }); + }); + + test('should resolve simple allOf', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + allOf: [{ type: 'string' }, { $id: 'urn:uuid:smartbear' }], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + User: { + type: 'string', + $id: 'urn:uuid:smartbear', + }, + }, + }, + }); + }); + + test('should resolve local references in allOf keyword', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + properties: {}, + allOf: [ + { $ref: '#/components/schemas/UserProfile' }, + { $id: 'urn:uuid:smartbear' }, + ], + }, + UserProfile: { + type: 'object', + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + User: { + properties: {}, + $id: 'urn:uuid:smartbear', + type: 'object', + }, + UserProfile: { + type: 'object', + }, + }, + }, + }); + }); + + test("shouldn't override properties of target Schema Object", async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + User: { + type: 'object', + allOf: [ + { type: 'string', customKeyword: 'val1' }, + { $id: 'urn:uuid:smartbear', customKeyword: 'val2' }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + User: { + type: 'object', + customKeyword: 'val2', + $id: 'urn:uuid:smartbear', + }, + }, + }, + }); + }); + + test('should retain $$ref meta patches', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + }, + Cat: { + allOf: [ + { $ref: '#/components/schemas/Pet' }, + { + type: 'object', + properties: { + meow: { + type: 'string', + }, + }, + }, + ], + }, + Animal: { + type: 'object', + properties: { + pet: { + $ref: '#/components/schemas/Pet', + }, + cat: { + $ref: '#/components/schemas/Cat', + }, + }, + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + dereference: { + strategies: [ + OpenApi3_1SwaggerClientDereferenceStrategy({ + allowMetaPatches: true, + }), + ], + }, + }); + + expect(toValue(dereferenced)).toMatchObject({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + }, + Cat: { + properties: { + meow: { + type: 'string', + }, + name: { + type: 'string', + }, + }, + type: 'object', + }, + Animal: { + type: 'object', + properties: { + pet: { + $$ref: expect.stringMatching(/#\/components\/schemas\/Pet$/), + properties: { + name: { + type: 'string', + }, + }, + type: 'object', + }, + cat: { + $$ref: expect.stringMatching(/#\/components\/schemas\/Cat$/), + properties: { + meow: { + type: 'string', + }, + name: { + type: 'string', + }, + }, + type: 'object', + }, + }, + }, + }, + }, + }); + }); + + test('should merge allOf items, deeply', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + Cat: { + allOf: [ + { properties: { cat: { type: 'object' } } }, + { properties: { cat: { type: 'string' } } }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + Cat: { + properties: { + cat: { + type: 'string', + }, + }, + }, + }, + }, + }); + }); + + test('should resolve nested allOf', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + Cat: { + allOf: [ + { + allOf: [{ type: 'string' }], + }, + { maximum: 1 }, + { + allOf: [ + { exclusiveMaximum: 2 }, + { + allOf: [{ minimum: 3 }, { exclusiveMinimum: 4 }], + }, + ], + }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + Cat: { + type: 'string', + maximum: 1, + exclusiveMaximum: 2, + minimum: 3, + exclusiveMinimum: 4, + }, + }, + }, + }); + }); + + test('should support nested allOfs with $refs', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + D: { + type: 'object', + properties: { + z: { + type: 'string', + description: 'Some Z string', + }, + }, + }, + C: { + type: 'object', + properties: { + d: { + title: 'D', + allOf: [ + { + description: 'Some D', + }, + { + $ref: '#/components/schemas/D', + }, + ], + }, + }, + }, + B: { + type: 'object', + properties: { + c: { + title: 'C', + allOf: [ + { + description: 'Some C', + }, + { + $ref: '#/components/schemas/C', + }, + ], + }, + }, + }, + A: { + type: 'object', + properties: { + b: { + title: 'B', + allOf: [ + { + $ref: '#/components/schemas/B', + }, + { + description: 'Some B', + }, + ], + }, + }, + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + D: { + type: 'object', + properties: { z: { type: 'string', description: 'Some Z string' } }, + }, + C: { + type: 'object', + properties: { + d: { + description: 'Some D', + type: 'object', + properties: { z: { type: 'string', description: 'Some Z string' } }, + title: 'D', + }, + }, + }, + B: { + type: 'object', + properties: { + c: { + description: 'Some C', + type: 'object', + properties: { + d: { + description: 'Some D', + type: 'object', + properties: { z: { type: 'string', description: 'Some Z string' } }, + title: 'D', + }, + }, + title: 'C', + }, + }, + }, + A: { + type: 'object', + properties: { + b: { + type: 'object', + properties: { + c: { + description: 'Some C', + type: 'object', + properties: { + d: { + description: 'Some D', + type: 'object', + properties: { z: { type: 'string', description: 'Some Z string' } }, + title: 'D', + }, + }, + title: 'C', + }, + }, + description: 'Some B', + title: 'B', + }, + }, + }, + }, + }, + }); + }); + + test('should deepmerge arrays inside of an `allOf`', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + one: { + allOf: [ + { + $ref: '#/components/schemas/two', + }, + { + type: 'object', + required: ['a', 'b'], + properties: { + nested: { + type: 'object', + required: ['e'], + }, + }, + }, + ], + }, + two: { + allOf: [ + { + type: 'object', + required: ['c', 'd'], + properties: { + nested: { + type: 'object', + required: ['f'], + }, + }, + }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + one: { + type: 'object', + required: ['c', 'd', 'a', 'b'], + properties: { + nested: { + type: 'object', + required: ['f', 'e'], + }, + }, + }, + two: { + type: 'object', + required: ['c', 'd'], + properties: { + nested: { + type: 'object', + required: ['f'], + }, + }, + }, + }, + }, + }); + }); + + test('should handle case, with an `allOf` referencing an `allOf`', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + one: { + allOf: [ + { + $ref: '#/components/schemas/two', + }, + { + type: 'object', + }, + ], + }, + two: { + allOf: [ + { + type: 'object', + }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + one: { + type: 'object', + }, + two: { + type: 'object', + }, + }, + }, + }); + }); + + test('should suppress merging example keyword', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + example: { + name: 'my pet', + }, + }, + Cat: { + allOf: [ + { $ref: '#/components/schemas/Pet' }, + { + type: 'object', + properties: { + meow: { + type: 'string', + }, + }, + example: { + name: 'my cat', + meow: 'meow', + }, + }, + ], + }, + PetCat: { + allOf: [ + { $ref: '#/components/schemas/Pet' }, + { $ref: '#/components/schemas/Cat' }, + ], + properties: { + id: { + type: 'string', + }, + }, + example: { + id: '1', + }, + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + example: { + name: 'my pet', + }, + }, + Cat: { + type: 'object', + properties: { + name: { + type: 'string', + }, + meow: { + type: 'string', + }, + }, + example: { + name: 'my cat', + meow: 'meow', + }, + }, + PetCat: { + type: 'object', + properties: { + id: { + type: 'string', + }, + name: { + type: 'string', + }, + meow: { + type: 'string', + }, + }, + example: { + id: '1', + }, + }, + }, + }, + }); + }); + + test('should suppress merging examples keyword', async () => { + const spec = OpenApi3_1Element.refract({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + examples: [ + { + name: 'my pet', + }, + ], + }, + Cat: { + allOf: [ + { $ref: '#/components/schemas/Pet' }, + { + type: 'object', + properties: { + meow: { + type: 'string', + }, + }, + examples: [ + { + name: 'my cat', + meow: 'meow', + }, + ], + }, + ], + }, + PetCat: { + allOf: [ + { $ref: '#/components/schemas/Pet' }, + { $ref: '#/components/schemas/Cat' }, + ], + properties: { + id: { + type: 'string', + }, + }, + examples: [ + { + id: '1', + }, + ], + }, + }, + }, + }); + const dereferenced = await dereferenceApiDOM(spec, { + parse: { mediaType: mediaTypes.latest('json') }, + }); + + expect(toValue(dereferenced)).toEqual({ + openapi: '3.1.0', + components: { + schemas: { + Pet: { + type: 'object', + properties: { + name: { + type: 'string', + }, + }, + examples: [ + { + name: 'my pet', + }, + ], + }, + Cat: { + type: 'object', + properties: { + name: { + type: 'string', + }, + meow: { + type: 'string', + }, + }, + examples: [ + { + name: 'my pet', + }, + { + name: 'my cat', + meow: 'meow', + }, + ], + }, + PetCat: { + type: 'object', + properties: { + id: { + type: 'string', + }, + name: { + type: 'string', + }, + meow: { + type: 'string', + }, + }, + examples: [ + { + id: '1', + }, + ], + }, + }, + }, + }); + }); + }); + }); + }); +}); +/* eslint-enable camelcase */ diff --git a/test/specmap/all-of.js b/test/specmap/all-of.js index 08a71a7900..97b25d15eb 100644 --- a/test/specmap/all-of.js +++ b/test/specmap/all-of.js @@ -61,8 +61,12 @@ describe('allOf', () => { allOf: [ { original: 'no', + subOriginal: 'no1', notOriginal: 'yes', }, + { + subOriginal: 'no2', + }, ], }, plugins: [plugins.refs, plugins.allOf], @@ -71,6 +75,7 @@ describe('allOf', () => { errors: [], spec: { original: 'yes', + subOriginal: 'no2', notOriginal: 'yes', }, });