Skip to content

Commit

Permalink
chore: bump http-spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Jankowski committed Dec 26, 2023
1 parent 4da75fe commit 22efb19
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 24 deletions.
4 changes: 2 additions & 2 deletions packages/elements-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
]
},
"dependencies": {
"@stoplight/http-spec": "^6.0.0",
"@stoplight/http-spec": "^7.0.1",
"@stoplight/json": "^3.18.1",
"@stoplight/json-schema-ref-parser": "^9.0.5",
"@stoplight/json-schema-sampler": "0.2.3",
Expand All @@ -69,7 +69,7 @@
"@stoplight/mosaic-code-viewer": "^1.46.1",
"@stoplight/path": "^1.3.2",
"@stoplight/react-error-boundary": "^3.0.0",
"@stoplight/types": "^14.0.0",
"@stoplight/types": "^14.1.0",
"@stoplight/yaml": "^4.2.3",
"classnames": "^2.2.6",
"httpsnippet-lite": "^3.0.5",
Expand Down
2 changes: 1 addition & 1 deletion packages/elements-dev-portal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@stoplight/markdown-viewer": "^5.5.0",
"@stoplight/mosaic": "^1.46.1",
"@stoplight/path": "^1.3.2",
"@stoplight/types": "^14.0.0",
"@stoplight/types": "^14.1.0",
"classnames": "^2.2.6",
"lodash": "^4.17.19",
"react-query": "^3.34.19",
Expand Down
4 changes: 2 additions & 2 deletions packages/elements/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@
},
"dependencies": {
"@stoplight/elements-core": "~7.16.2",
"@stoplight/http-spec": "^6.0.0",
"@stoplight/http-spec": "^7.0.1",
"@stoplight/json": "^3.18.1",
"@stoplight/mosaic": "^1.46.1",
"@stoplight/types": "^14.0.0",
"@stoplight/types": "^14.1.0",
"@stoplight/yaml": "^4.2.3",
"classnames": "^2.2.6",
"file-saver": "^2.0.5",
Expand Down
25 changes: 18 additions & 7 deletions packages/elements/src/utils/oas/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ import { slugify } from '@stoplight/elements-core';
import type {
Oas2HttpOperationTransformer,
Oas2HttpServiceTransformer,
Oas3HttpOperationTransformer,
Oas3HttpEndpointOperationTransformer,
Oas3HttpServiceTransformer,
} from '@stoplight/http-spec/oas';
import { OPERATION_CONFIG } from '@stoplight/http-spec/oas';
import { transformOas2Operation, transformOas2Service } from '@stoplight/http-spec/oas2';
import { transformOas3Operation, transformOas3Service } from '@stoplight/http-spec/oas3';
import { encodePointerFragment, pointerToPath } from '@stoplight/json';
import { NodeType } from '@stoplight/types';
import { IHttpOperation, NodeType } from '@stoplight/types';
import { get, isObject, last } from 'lodash';
import { OpenAPIObject } from 'openapi3-ts';
import { Spec } from 'swagger-schema-official';
Expand Down Expand Up @@ -40,11 +41,16 @@ export function transformOasToServiceNode(apiDescriptionDocument: unknown) {
{ ...apiDescriptionDocument, jsonSchemaDialect: 'http://json-schema.org/draft-07/schema#' },
oas3SourceMap,
transformOas3Service,
transformOas3Operation,
transformOas3Operation as Oas3HttpEndpointOperationTransformer<IHttpOperation>,
);
}
if (isOas3(apiDescriptionDocument)) {
return computeServiceNode(apiDescriptionDocument, oas3SourceMap, transformOas3Service, transformOas3Operation);
return computeServiceNode(
apiDescriptionDocument,
oas3SourceMap,
transformOas3Service,
transformOas3Operation as Oas3HttpEndpointOperationTransformer<IHttpOperation>,
);
} else if (isOas2(apiDescriptionDocument)) {
return computeServiceNode(apiDescriptionDocument, oas2SourceMap, transformOas2Service, transformOas2Operation);
}
Expand All @@ -56,7 +62,7 @@ function computeServiceNode(
document: Spec | OpenAPIObject,
map: ISourceNodeMap[],
transformService: Oas2HttpServiceTransformer | Oas3HttpServiceTransformer,
transformOperation: Oas2HttpOperationTransformer | Oas3HttpOperationTransformer,
transformOperation: Oas2HttpOperationTransformer | Oas3HttpEndpointOperationTransformer<IHttpOperation>,
) {
const serviceDocument = transformService({ document });
const serviceNode: ServiceNode = {
Expand All @@ -75,7 +81,7 @@ function computeChildNodes(
document: Spec | OpenAPIObject,
data: unknown,
map: ISourceNodeMap[],
transformer: Oas2HttpOperationTransformer | Oas3HttpOperationTransformer,
transformer: Oas2HttpOperationTransformer | Oas3HttpEndpointOperationTransformer<IHttpOperation>,
parentUri: string = '',
) {
const nodes: ServiceChildNode[] = [];
Expand All @@ -92,7 +98,12 @@ function computeChildNodes(
if (match.type === NodeTypes.Operation && jsonPath.length === 3) {
const path = String(jsonPath[1]);
const method = String(jsonPath[2]);
const operationDocument = transformer({ document, path, method });
const operationDocument = transformer({
document,
name: path,
method,
config: OPERATION_CONFIG,
});
let parsedUri;
const encodedPath = String(encodePointerFragment(path));

Expand Down
24 changes: 12 additions & 12 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3964,14 +3964,14 @@
dependencies:
eslint-config-prettier "^8.3.0"

"@stoplight/http-spec@^6.0.0":
version "6.0.0"
resolved "https://registry.yarnpkg.com/@stoplight/http-spec/-/http-spec-6.0.0.tgz#e472032b1dab536c9d0bbf76fbae0d9eae2f7e7d"
integrity sha512-bCNw24C0xSHJTJDKs7Bz6RViyZ593uS7rpfGvcA7bOIdNT5wzUwXY27TMIzGA5HV2aGawc4RPdc8CufluFaNTg==
"@stoplight/http-spec@^7.0.1":
version "7.0.1"
resolved "https://registry.yarnpkg.com/@stoplight/http-spec/-/http-spec-7.0.1.tgz#6802f3e426940e02d88126fc486237e73541ee81"
integrity sha512-9O34o331tDMwHEHEc0N5Mh39cvVtioono46SyMy/BWQwAhuVyVfzHZxlBHepe0grIDcTrJxsb8iARGi86luwoQ==
dependencies:
"@stoplight/json" "^3.18.1"
"@stoplight/json-schema-generator" "1.0.2"
"@stoplight/types" "14.0.0"
"@stoplight/types" "14.1.0"
"@types/json-schema" "7.0.11"
"@types/swagger-schema-official" "~2.0.22"
"@types/type-is" "^1.6.3"
Expand All @@ -3981,7 +3981,7 @@
lodash.pickby "^4.6.0"
openapi3-ts "^2.0.2"
postman-collection "^4.1.2"
tslib "^2.3.1"
tslib "^2.6.2"
type-is "^1.6.18"

"@stoplight/[email protected]":
Expand Down Expand Up @@ -4260,10 +4260,10 @@
shelljs "0.8.x"
tslib "^2.2.0"

"@stoplight/types@14.0.0", "@stoplight/types@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@stoplight/types/-/types-14.0.0.tgz#f444490664c2c16d5f06265fcbac8d94a33481e8"
integrity sha512-w7Ejau6TaB7RqR0vWzGJSdmgLEYD2frjgbHPZoxgGQwAq/R8Qh/D9p9Bl9JFdii+YTL5xoDjyX0c1WDRlbMV8g==
"@stoplight/types@14.1.0", "@stoplight/types@^14.1.0":
version "14.1.0"
resolved "https://registry.yarnpkg.com/@stoplight/types/-/types-14.1.0.tgz#36b04488acc1d8ab5bb712416f50d3bc99610b34"
integrity sha512-fL8Nzw03+diALw91xHEHA5Q0WCGeW9WpPgZQjodNUWogAgJ56aJs03P9YzsQ1J6fT7/XjDqHMgn7/RlsBzB/SQ==
dependencies:
"@types/json-schema" "^7.0.4"
utility-types "^3.10.0"
Expand Down Expand Up @@ -21901,12 +21901,12 @@ tslib@^1.13.0, tslib@^1.8.1, tslib@^1.9.0, tslib@^1.9.3:
resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tslib@^2, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.2.0, tslib@^2.3.0, tslib@^2.3.1:
tslib@^2, tslib@^2.0.0, tslib@^2.0.1, tslib@^2.0.3, tslib@^2.1.0, tslib@^2.2.0, tslib@^2.3.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==

tslib@^2.4.0:
tslib@^2.4.0, tslib@^2.6.2:
version "2.6.2"
resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae"
integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==
Expand Down

0 comments on commit 22efb19

Please sign in to comment.