Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/goofy-bats-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@gitbook/openapi-parser': patch
'@gitbook/react-openapi': patch
---

Bump Scalar
101 changes: 36 additions & 65 deletions bun.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/openapi-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"version": "3.0.4",
"sideEffects": false,
"dependencies": {
"@scalar/json-magic": "^0.3.1",
"@scalar/openapi-parser": "^0.20.1",
"@scalar/openapi-types": "^0.3.7"
"@scalar/json-magic": "^0.8.1",
"@scalar/openapi-parser": "^0.23.2",
"@scalar/openapi-types": "^0.5.1"
},
"devDependencies": {
"@tsconfig/strictest": "catalog:",
Expand Down
1 change: 1 addition & 0 deletions packages/openapi-parser/src/scalar-plugins/fetchURL.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const fetchURL = (): Plugin => ({
return {
ok: true,
data: normalize(text),
raw: text,
};
} catch {
return { ok: false };
Expand Down
5 changes: 3 additions & 2 deletions packages/openapi-parser/src/scalar-plugins/fetchURLs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,11 @@ export const fetchURLs = (customConfiguration: {
}
const text = await response.text();
// Try to normalize the text to be sure it's a valid JSON or YAML.
await normalize(text);
const normalized = await normalize(text);
return {
ok: true,
data: text,
data: normalized,
raw: text,
};
} catch {
return { ok: false };
Expand Down
4 changes: 2 additions & 2 deletions packages/react-openapi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"@gitbook/expr": "workspace:*",
"@gitbook/openapi-parser": "workspace:*",
"@scalar/api-client-react": "catalog:",
"@scalar/oas-utils": "^0.2.130",
"@scalar/types": "^0.1.9",
"@scalar/oas-utils": "^0.6.3",
"@scalar/types": "^0.4.0",
"classnames": "catalog:",
"flatted": "^3.2.9",
"json-xml-parse": "^1.3.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/react-openapi/src/OpenAPISpec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ function groupParameters(
const label = getParameterGroupName(parameter.in, context);
const group = groups.find((group) => group.key === key);
if (group) {
group.parameters.push(parameter);
// Use spread to avoid type issues with complex union type in OpenAPI.Parameters
group.parameters = [...group.parameters, parameter] as OpenAPI.Parameters;
} else {
groups.push({
key,
Expand Down
6 changes: 2 additions & 4 deletions packages/react-openapi/src/ScalarApiButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ function ScalarModal(props: {
return (
<ApiClientModalProvider
configuration={{ url: specUrl, ...prefillConfig }}
initialRequest={
method !== 'connect' ? { method: toScalarHttpMethod(method), path } : undefined
}
initialRequest={{ method: toScalarHttpMethod(method), path }}
>
<ScalarModalController method={method} path={path} controllerRef={controllerRef} />
</ApiClientModalProvider>
Expand All @@ -112,7 +110,7 @@ function ScalarModalController(props: {
const openScalarClient = client?.open;
const { onOpenClient: trackClientOpening } = useOpenAPIOperationContext();
const openClient = useMemo(() => {
if (openScalarClient && method !== 'connect') {
if (openScalarClient) {
return () => {
openScalarClient({
method: toScalarHttpMethod(method),
Expand Down
Loading