diff --git a/package.json b/package.json index a3094731..eea3e00f 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,10 @@ "types": "./index.d.ts", "default": "./index.js" }, + "./hash": { + "types": "./hash.d.ts", + "default": "./hash.js" + }, "./oas": { "types": "./oas/index.d.ts", "default": "./oas/index.js" @@ -65,7 +69,7 @@ }, "dependencies": { "@stoplight/json": "^3.18.0", - "@stoplight/types": "^13.0.0-beta.5", + "@stoplight/types": "^13.0.0", "@types/json-schema": "7.0.5", "@types/swagger-schema-official": "~2.0.21", "@types/type-is": "^1.6.3", diff --git a/src/context.ts b/src/context.ts index 0a4c3334..9f717075 100644 --- a/src/context.ts +++ b/src/context.ts @@ -1,6 +1,4 @@ import { hasRef, isLocalRef } from '@stoplight/json'; -// @ts-ignore -import * as fnv from 'fnv-plus'; import type { AvailableContext, @@ -11,8 +9,6 @@ import type { TranslateFunction, } from './types'; -export const DEFAULT_ID_GENERATOR: IdGenerator = input => fnv.fast1a52hex(input); - export function createContext>( document: T, resolveRef: RefResolver, diff --git a/src/hash.ts b/src/hash.ts new file mode 100644 index 00000000..97962cda --- /dev/null +++ b/src/hash.ts @@ -0,0 +1,6 @@ +// @ts-expect-error: no types +import * as fnv from 'fnv-plus'; + +import type { IdGenerator } from './types'; + +export const hash: IdGenerator = input => fnv.fast1a52hex(input); diff --git a/src/oas/__tests__/accessors.test.ts b/src/oas/__tests__/accessors.test.ts index f608f4b0..5139939d 100644 --- a/src/oas/__tests__/accessors.test.ts +++ b/src/oas/__tests__/accessors.test.ts @@ -1,16 +1,11 @@ -import { createContext, DEFAULT_ID_GENERATOR } from '../../context'; import { Fragment } from '../../types'; import { createOasParamsIterator } from '../accessors'; -import { resolveRef } from '../resolver'; +import { createContext } from '../context'; import { OasVersion } from '../types'; const getValidOasParameters = (document: { paths: { '/': { get: Fragment } } }, spec: OasVersion) => Array.from( - createOasParamsIterator(spec as any).call( - createContext(document, resolveRef, DEFAULT_ID_GENERATOR), - document.paths['/'], - document.paths['/'].get, - ), + createOasParamsIterator(spec as any).call(createContext(document), document.paths['/'], document.paths['/'].get), ); describe('createOasParamsIterator', () => { diff --git a/src/oas/__tests__/tags.test.ts b/src/oas/__tests__/tags.test.ts index 852c3a0a..d701157a 100644 --- a/src/oas/__tests__/tags.test.ts +++ b/src/oas/__tests__/tags.test.ts @@ -1,9 +1,7 @@ -import { createContext, DEFAULT_ID_GENERATOR } from '../../context'; -import { resolveRef } from '../resolver'; +import { createContext } from '../context'; import { translateToTags as _translateToTags } from '../tags'; -const translateToTags = (tags: unknown) => - _translateToTags.call(createContext({}, resolveRef, DEFAULT_ID_GENERATOR), tags); +const translateToTags = (tags: unknown) => _translateToTags.call(createContext({}), tags); describe('translateToTags', () => { describe.each([2, null, {}, '', 0])('when tags property is not an array', tags => { diff --git a/src/oas/context.ts b/src/oas/context.ts new file mode 100644 index 00000000..e3caca7d --- /dev/null +++ b/src/oas/context.ts @@ -0,0 +1,8 @@ +import { createContext as _createContext } from '../context'; +import { hash } from '../hash'; +import type { Fragment } from '../types'; +import { resolveRef } from './resolver'; + +export function createContext(document: T) { + return _createContext(document, resolveRef, hash); +} diff --git a/src/oas/transformers/schema/__tests__/schema.spec.ts b/src/oas/transformers/schema/__tests__/schema.spec.ts index cca91501..32e85a7f 100644 --- a/src/oas/transformers/schema/__tests__/schema.spec.ts +++ b/src/oas/transformers/schema/__tests__/schema.spec.ts @@ -1,10 +1,8 @@ -import { createContext, DEFAULT_ID_GENERATOR } from '../../../../context'; -import { resolveRef } from '../../../resolver'; +import { createContext } from '../../../context'; import { translateSchemaObject } from '..'; import type { OASSchemaObject } from '../types'; -const translate = (schemaObject: OASSchemaObject) => - translateSchemaObject.call(createContext({}, resolveRef, DEFAULT_ID_GENERATOR), schemaObject); +const translate = (schemaObject: OASSchemaObject) => translateSchemaObject.call(createContext({}), schemaObject); describe('translateSchemaObject', () => { it('should translate id', () => { diff --git a/src/oas2/operation.ts b/src/oas2/operation.ts index 0ee05d52..1955e6e8 100644 --- a/src/oas2/operation.ts +++ b/src/oas2/operation.ts @@ -1,9 +1,8 @@ import type { DeepPartial, IHttpOperation } from '@stoplight/types'; import type { Spec } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../context'; +import { createContext } from '../oas/context'; import { transformOasOperation, transformOasOperations } from '../oas/operation'; -import { resolveRef } from '../oas/resolver'; import { Oas2HttpOperationTransformer } from '../oas/types'; import type { Fragment } from '../types'; import { translateToRequest } from './transformers/request'; @@ -16,7 +15,7 @@ export function transformOas2Operations(document: DeepPartial): IHttpOpera } export const transformOas2Operation: Oas2HttpOperationTransformer = ({ document: _document, path, method }) => { - const ctx = createContext(_document, resolveRef, DEFAULT_ID_GENERATOR); + const ctx = createContext(_document); const httpOperation = transformOasOperation.call(ctx, path, method); const pathObj = ctx.maybeResolveLocalRef(ctx.document.paths![path]) as Fragment; const operation = ctx.maybeResolveLocalRef(pathObj[method]) as Fragment; diff --git a/src/oas2/service.ts b/src/oas2/service.ts index 344282f5..190ffafd 100644 --- a/src/oas2/service.ts +++ b/src/oas2/service.ts @@ -1,9 +1,8 @@ import { isPlainObject } from '@stoplight/json'; import pickBy = require('lodash.pickby'); -import { createContext, DEFAULT_ID_GENERATOR } from '../context'; import { isNonNullable, isString } from '../guards'; -import { resolveRef } from '../oas/resolver'; +import { createContext } from '../oas/context'; import { transformOasService } from '../oas/service'; import { Oas2HttpServiceTransformer } from '../oas/types'; import { entries } from '../utils'; @@ -11,7 +10,7 @@ import { translateToSingleSecurity } from './transformers/securities'; import { translateToServer } from './transformers/servers'; export const transformOas2Service: Oas2HttpServiceTransformer = ({ document }) => { - const ctx = createContext(document, resolveRef, DEFAULT_ID_GENERATOR); + const ctx = createContext(document); const httpService = transformOasService.call(ctx); if (document.info?.license) { diff --git a/src/oas2/transformers/__tests__/__snapshots__/params.test.ts.snap b/src/oas2/transformers/__tests__/__snapshots__/params.test.ts.snap index e212b60d..e3a5700f 100644 --- a/src/oas2/transformers/__tests__/__snapshots__/params.test.ts.snap +++ b/src/oas2/transformers/__tests__/__snapshots__/params.test.ts.snap @@ -74,46 +74,45 @@ Object { exports[`params.translator translateToHeaderParams should translate empty dictionary to empty array 1`] = `Array []`; exports[`params.translator translateToHeaderParams should translate to multiple header params 1`] = ` -Array [ - Object { - "description": "a description", - "id": "117996bbb6f45", - "name": "header-name", - "schema": Object { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "string", - "x-stoplight-id": "9259b14a1615b", - }, - "style": "simple", +Object { + "description": "a description", + "id": "117996bbb6f45", + "name": "header-name", + "schema": Object { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "string", + "x-stoplight-id": Any, }, - Object { - "description": "another description", - "id": "dce8b374eb7d6", - "name": "plain-tex", - "schema": Object { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "string", - "x-stoplight-id": "31f792c907f10", - }, - "style": "simple", + "style": "simple", +} +`; + +exports[`params.translator translateToHeaderParams should translate to multiple header params 2`] = ` +Object { + "description": "another description", + "id": "dce8b374eb7d6", + "name": "plain-tex", + "schema": Object { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "string", + "x-stoplight-id": Any, }, -] + "style": "simple", +} `; exports[`params.translator translateToHeaderParams should translate to simple header param 1`] = ` -Array [ - Object { - "description": "a description", - "id": "117996bbb6f45", - "name": "header-name", - "schema": Object { - "$schema": "http://json-schema.org/draft-07/schema#", - "type": "string", - "x-stoplight-id": "9259b14a1615b", - }, - "style": "simple", +Object { + "description": "a description", + "id": "117996bbb6f45", + "name": "header-name", + "schema": Object { + "$schema": "http://json-schema.org/draft-07/schema#", + "type": "string", + "x-stoplight-id": Any, }, -] + "style": "simple", +} `; exports[`params.translator translateToPathParameter should translate 1`] = ` diff --git a/src/oas2/transformers/__tests__/params.test.ts b/src/oas2/transformers/__tests__/params.test.ts index 518d59b1..46e6c2af 100644 --- a/src/oas2/transformers/__tests__/params.test.ts +++ b/src/oas2/transformers/__tests__/params.test.ts @@ -1,8 +1,7 @@ import { DeepPartial, HttpParamStyles } from '@stoplight/types'; import { FormDataParameter, QueryParameter, Spec } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateFromFormDataParameters as _translateFromFormDataParameters, translateToBodyParameter as _translateToBodyParameter, @@ -15,28 +14,28 @@ import { const translateFromFormDataParameters = ( document: DeepPartial, ...params: Parameters -) => _translateFromFormDataParameters.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); +) => _translateFromFormDataParameters.call(createContext(document), ...params); const translateToBodyParameter = ( document: DeepPartial, ...params: Parameters -) => _translateToBodyParameter.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); +) => _translateToBodyParameter.call(createContext(document), ...params); const translateToHeaderParam = (document: DeepPartial, ...params: Parameters) => - _translateToHeaderParam.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); + _translateToHeaderParam.call(createContext(document), ...params); const translateToHeaderParams = (document: DeepPartial, ...params: Parameters) => - _translateToHeaderParams.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); + _translateToHeaderParams.call(createContext(document), ...params); const translateToPathParameter = ( document: DeepPartial, ...params: Parameters -) => _translateToPathParameter.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); +) => _translateToPathParameter.call(createContext(document), ...params); const translateToQueryParameter = ( document: DeepPartial, ...params: Parameters -) => _translateToQueryParameter.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); +) => _translateToQueryParameter.call(createContext(document), ...params); describe('params.translator', () => { let consumes = ['*']; @@ -70,35 +69,50 @@ describe('params.translator', () => { }); it('should translate to simple header param', () => { - expect( - translateToHeaderParams( - {}, - { - 'header-name': { - description: 'a description', - type: 'string', - }, + const params = translateToHeaderParams( + {}, + { + 'header-name': { + description: 'a description', + type: 'string', }, - ), - ).toMatchSnapshot(); + }, + ); + + expect(params).toHaveLength(1); + expect(params[0]).toMatchSnapshot({ + schema: { + 'x-stoplight-id': expect.any(String), + }, + }); }); it('should translate to multiple header params', () => { - expect( - translateToHeaderParams( - {}, - { - 'header-name': { - description: 'a description', - type: 'string', - }, - 'plain-tex': { - description: 'another description', - type: 'string', - }, + const params = translateToHeaderParams( + {}, + { + 'header-name': { + description: 'a description', + type: 'string', }, - ), - ).toMatchSnapshot(); + 'plain-tex': { + description: 'another description', + type: 'string', + }, + }, + ); + + expect(params).toHaveLength(2); + expect(params[0]).toMatchSnapshot({ + schema: { + 'x-stoplight-id': expect.any(String), + }, + }); + expect(params[1]).toMatchSnapshot({ + schema: { + 'x-stoplight-id': expect.any(String), + }, + }); }); }); diff --git a/src/oas2/transformers/__tests__/request.test.ts b/src/oas2/transformers/__tests__/request.test.ts index a79c060d..4b990b1b 100644 --- a/src/oas2/transformers/__tests__/request.test.ts +++ b/src/oas2/transformers/__tests__/request.test.ts @@ -6,8 +6,7 @@ import { QueryParameter, } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateFromFormDataParameters, translateToBodyParameter, @@ -20,7 +19,7 @@ import { translateToRequest as _translateToRequest } from '../request'; jest.mock('../params'); const translateToRequest = (path: Record, parameters: any[]) => { - const ctx = createContext({ consumes: ['*'], paths: { '/api': { parameters } } }, resolveRef, DEFAULT_ID_GENERATOR); + const ctx = createContext({ consumes: ['*'], paths: { '/api': { parameters } } }); return _translateToRequest.call(ctx, path, { parameters }); }; diff --git a/src/oas2/transformers/__tests__/responses.test.ts b/src/oas2/transformers/__tests__/responses.test.ts index 95915e2d..10b33ead 100644 --- a/src/oas2/transformers/__tests__/responses.test.ts +++ b/src/oas2/transformers/__tests__/responses.test.ts @@ -1,12 +1,11 @@ import { DeepPartial } from '@stoplight/types'; import { Operation, Schema, Spec } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToResponses as _translateToResponses } from '../responses'; const translateToResponses = (document: DeepPartial, responses: DeepPartial) => - _translateToResponses.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), { responses }); + _translateToResponses.call(createContext(document), { responses }); describe('responses', () => { const produces = ['application/json', 'application/xml']; diff --git a/src/oas2/transformers/__tests__/securities.test.ts b/src/oas2/transformers/__tests__/securities.test.ts index c47e799d..3fe044dd 100644 --- a/src/oas2/transformers/__tests__/securities.test.ts +++ b/src/oas2/transformers/__tests__/securities.test.ts @@ -1,12 +1,11 @@ import { DeepPartial } from '@stoplight/types'; import { Spec } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToSecurities as _translateToSecurities } from '../securities'; const translateToSecurities = (document: DeepPartial, ...params: Parameters) => - _translateToSecurities.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); + _translateToSecurities.call(createContext(document), ...params); describe('securities', () => { describe('translateToSecurities', () => { diff --git a/src/oas2/transformers/__tests__/servers.test.ts b/src/oas2/transformers/__tests__/servers.test.ts index 0f10b8bf..64a82ec9 100644 --- a/src/oas2/transformers/__tests__/servers.test.ts +++ b/src/oas2/transformers/__tests__/servers.test.ts @@ -1,14 +1,13 @@ import type { DeepPartial } from '@stoplight/types'; import type { Spec } from 'swagger-schema-official'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToServers as _translateToServers } from '../servers'; type GlobalWithLocation = typeof global & { location?: Partial & { href: string } }; const translateToServers = (document: DeepPartial, ...params: Parameters) => - _translateToServers.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), ...params); + _translateToServers.call(createContext(document), ...params); describe('translateToServers', () => { afterAll(() => { diff --git a/src/oas3/operation.ts b/src/oas3/operation.ts index ca08e7ca..ad325964 100644 --- a/src/oas3/operation.ts +++ b/src/oas3/operation.ts @@ -2,10 +2,9 @@ import type { DeepPartial, IHttpOperation } from '@stoplight/types'; import pickBy = require('lodash.pickby'); import type { OpenAPIObject } from 'openapi3-ts'; -import { createContext, DEFAULT_ID_GENERATOR } from '../context'; import { isNonNullable } from '../guards'; import { transformOasOperation, transformOasOperations } from '../oas'; -import { resolveRef } from '../oas/resolver'; +import { createContext } from '../oas/context'; import type { Oas3HttpOperationTransformer } from '../oas/types'; import { Fragment } from '../types'; import { translateToCallbacks } from './transformers/callbacks'; @@ -19,7 +18,7 @@ export function transformOas3Operations(document: DeepPartial): I } export const transformOas3Operation: Oas3HttpOperationTransformer = ({ document: _document, path, method }) => { - const ctx = createContext(_document, resolveRef, DEFAULT_ID_GENERATOR); + const ctx = createContext(_document); const httpOperation = transformOasOperation.call(ctx, path, method); const pathObj = ctx.maybeResolveLocalRef(ctx.document.paths![path]) as Fragment; const operation = ctx.maybeResolveLocalRef(pathObj[method]) as Fragment; diff --git a/src/oas3/service.ts b/src/oas3/service.ts index 984418ad..0a161981 100644 --- a/src/oas3/service.ts +++ b/src/oas3/service.ts @@ -2,9 +2,9 @@ import { isPlainObject } from '@stoplight/json'; import type { HttpSecurityScheme, Optional } from '@stoplight/types'; import pickBy = require('lodash.pickby'); -import { createContext, DEFAULT_ID_GENERATOR, withContext } from '../context'; +import { withContext } from '../context'; import { isNonNullable } from '../guards'; -import { resolveRef } from '../oas/resolver'; +import { createContext } from '../oas/context'; import { transformOasService } from '../oas/service'; import type { Oas3HttpServiceTransformer } from '../oas/types'; import { ArrayCallbackParameters } from '../types'; @@ -15,7 +15,7 @@ import { translateToServer } from './transformers/servers'; import { Oas3TranslateFunction } from './types'; export const transformOas3Service: Oas3HttpServiceTransformer = ({ document: _document }) => { - const ctx = createContext(_document, resolveRef, DEFAULT_ID_GENERATOR); + const ctx = createContext(_document); const { document } = ctx; const httpService = transformOasService.call(ctx); diff --git a/src/oas3/transformers/__tests__/content.test.ts b/src/oas3/transformers/__tests__/content.test.ts index 47017ebd..ac4ea12d 100644 --- a/src/oas3/transformers/__tests__/content.test.ts +++ b/src/oas3/transformers/__tests__/content.test.ts @@ -1,17 +1,16 @@ import type { SchemaObject } from 'openapi3-ts'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateHeaderObject as _translateHeaderObject, translateMediaTypeObject as _translateMediaTypeObject, } from '../content'; const translateMediaTypeObject = (document: any, object: unknown, key: string) => - _translateMediaTypeObject.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), [key, object], 0, []); + _translateMediaTypeObject.call(createContext(document), [key, object], 0, []); const translateHeaderObject = (object: unknown, key: string) => - _translateHeaderObject.call(createContext({}, resolveRef, DEFAULT_ID_GENERATOR), [key, object], 0, []); + _translateHeaderObject.call(createContext({}), [key, object], 0, []); describe('translateMediaTypeObject', () => { afterEach(() => { diff --git a/src/oas3/transformers/__tests__/request.test.ts b/src/oas3/transformers/__tests__/request.test.ts index fa13a427..51c03b46 100644 --- a/src/oas3/transformers/__tests__/request.test.ts +++ b/src/oas3/transformers/__tests__/request.test.ts @@ -1,9 +1,8 @@ -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToRequest as _translateToRequest } from '../request'; const translateToRequest = (path: Record, operation: Record) => - _translateToRequest.call(createContext({}, resolveRef, DEFAULT_ID_GENERATOR), path, operation); + _translateToRequest.call(createContext({}), path, operation); describe('translateOas3ToRequest', () => { it('given no request body should translate parameters', () => { diff --git a/src/oas3/transformers/__tests__/responses.test.ts b/src/oas3/transformers/__tests__/responses.test.ts index 934851de..d6d52b39 100644 --- a/src/oas3/transformers/__tests__/responses.test.ts +++ b/src/oas3/transformers/__tests__/responses.test.ts @@ -1,12 +1,11 @@ import type { DeepPartial } from '@stoplight/types'; import { OpenAPIObject } from 'openapi3-ts'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToResponses as _translateToResponses } from '../responses'; const translateToResponses = (document: DeepPartial, responses: unknown) => - _translateToResponses.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), responses); + _translateToResponses.call(createContext(document), responses); describe('translateToOas3Responses', () => { it('given empty dictionary should return empty array', () => { diff --git a/src/oas3/transformers/__tests__/securities.test.ts b/src/oas3/transformers/__tests__/securities.test.ts index f24f7c46..2b59b624 100644 --- a/src/oas3/transformers/__tests__/securities.test.ts +++ b/src/oas3/transformers/__tests__/securities.test.ts @@ -1,13 +1,12 @@ import { DeepPartial } from '@stoplight/types'; import { OpenAPIObject } from 'openapi3-ts'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { OperationSecurities } from '../../accessors'; import { translateToSecurities as _translateToSecurities } from '../securities'; const translateToSecurities = (document: DeepPartial, operationSecurities: OperationSecurities) => - _translateToSecurities.call(createContext(document, resolveRef, DEFAULT_ID_GENERATOR), operationSecurities); + _translateToSecurities.call(createContext(document), operationSecurities); describe('securities', () => { describe('translateToSecurities', () => { diff --git a/src/oas3/transformers/__tests__/servers.test.ts b/src/oas3/transformers/__tests__/servers.test.ts index 5146df72..1d854e91 100644 --- a/src/oas3/transformers/__tests__/servers.test.ts +++ b/src/oas3/transformers/__tests__/servers.test.ts @@ -1,18 +1,12 @@ import { DeepPartial } from '@stoplight/types'; import { OpenAPIObject } from 'openapi3-ts'; -import { createContext, DEFAULT_ID_GENERATOR } from '../../../context'; -import { resolveRef } from '../../../oas/resolver'; +import { createContext } from '../../../oas/context'; import { translateToServers as _translateToServers } from '../servers'; const translateToServers = ( document: DeepPartial & { paths: { '/pet': { get: Record } } }, -) => - _translateToServers.call( - createContext(document, resolveRef, DEFAULT_ID_GENERATOR), - document.paths['/pet'], - document.paths['/pet'].get, - ); +) => _translateToServers.call(createContext(document), document.paths['/pet'], document.paths['/pet'].get); describe('translateToServers', () => { it('translate single ServerObject to IServer', () => { diff --git a/yarn.lock b/yarn.lock index e8658755..26bb794b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1089,10 +1089,10 @@ "@types/json-schema" "^7.0.4" utility-types "^3.10.0" -"@stoplight/types@^13.0.0-beta.5": - version "13.0.0-beta.5" - resolved "https://registry.yarnpkg.com/@stoplight/types/-/types-13.0.0-beta.5.tgz#31804f3d1e6369a6daeff985dd0ca7ab27637f70" - integrity sha512-qZgWB3QxoOJL2TsbSfPSyStsnH7BwvAljcT2xa0ZowP3/Eh16OYS/PWzQzTU/GZ+btyqpowGgTragLUgipQAjQ== +"@stoplight/types@^13.0.0": + version "13.0.0" + resolved "https://registry.yarnpkg.com/@stoplight/types/-/types-13.0.0.tgz#69a22d57d3a67f623a01929b10e25401c9635154" + integrity sha512-9OTVMiSUz2NlEW14OL6NKOuMTj3dtVVsugRwe3qbq0QnUpx/VLxOuO83n47rXZUTHvk69arOlFrDmRyZMw2DUg== dependencies: "@types/json-schema" "^7.0.4" utility-types "^3.10.0"