Skip to content

Commit 9d3391b

Browse files
committed
chore: declare har core dependency
1 parent 78a78c4 commit 9d3391b

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

packages/docusaurus-theme-openapi-docs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"postman-collection": "^5.0.2",
5757
"httpsnippet-lite": "^3.0.5",
5858
"@har-sdk/postman": "^2.4.7",
59+
"@har-sdk/core": "^1.5.0",
5960
"prism-react-renderer": "^2.4.1",
6061
"process": "^0.11.10",
6162
"react-hook-form": "^7.59.0",

packages/docusaurus-theme-openapi-docs/src/theme/ApiExplorer/CodeSnippets/index.tsx

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88
import React, { useEffect, useState } from "react";
99

1010
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
11+
import { Postman } from "@har-sdk/core";
1112
import { postman2har } from "@har-sdk/postman";
1213
import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";
1314
import buildPostmanRequest from "@theme/ApiExplorer/buildPostmanRequest";
1415
import CodeTabs from "@theme/ApiExplorer/CodeTabs";
1516
import { useTypedSelector } from "@theme/ApiItem/hooks";
16-
import HTTPSnippet from "httpsnippet-lite";
17+
import { HTTPSnippet, TargetId } from "httpsnippet-lite";
1718
import cloneDeep from "lodash/cloneDeep";
1819
import * as sdk from "postman-collection";
1920

@@ -165,9 +166,15 @@ function CodeSnippets({
165166
const collection = new sdk.Collection({
166167
item: [{ name: "request", request: cleanedPostmanRequest }],
167168
});
168-
const [harRequest] = await postman2har(collection.toJSON());
169-
const snippet = new HTTPSnippet(harRequest).convert(
170-
mergedLanguage.language,
169+
const [harRequest] = await postman2har({
170+
...collection.toJSON(),
171+
info: {
172+
schema:
173+
"https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
174+
},
175+
} as Postman.Document);
176+
const snippet = await new HTTPSnippet(harRequest).convert(
177+
mergedLanguage.language as TargetId,
171178
mergedLanguage.variant,
172179
mergedLanguage.options
173180
);
@@ -201,9 +208,15 @@ function CodeSnippets({
201208
const collection = new sdk.Collection({
202209
item: [{ name: "request", request: cleanedPostmanRequest }],
203210
});
204-
const [harRequest] = await postman2har(collection.toJSON());
205-
const snippet = new HTTPSnippet(harRequest).convert(
206-
mergedLanguage.language,
211+
const [harRequest] = await postman2har({
212+
...collection.toJSON(),
213+
info: {
214+
schema:
215+
"https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
216+
},
217+
} as Postman.Document);
218+
const snippet = await new HTTPSnippet(harRequest).convert(
219+
mergedLanguage.language as TargetId,
207220
selectedVariant,
208221
mergedLanguage.options
209222
);

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2127,7 +2127,7 @@
21272127
dependencies:
21282128
"@hapi/hoek" "^9.0.0"
21292129

2130-
"@har-sdk/[email protected]":
2130+
"@har-sdk/[email protected]", "@har-sdk/core@^1.5.0":
21312131
version "1.5.0"
21322132
resolved "https://registry.yarnpkg.com/@har-sdk/core/-/core-1.5.0.tgz#d9f8bac773465475674af5cd185e5e37e848ecf9"
21332133
integrity sha512-djc7HOTwclLDQj1v3aK7xmpwTcR7FnjJ2WTd1Q9MYwrfAldWgKscgJVWvNPsomtqRUdi8CQAsV5TiN/HykdrAw==

0 commit comments

Comments
 (0)