fumadocs-openapi 5.4.1 → 5.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -579,19 +579,15 @@ function Schema({ name, schema, ctx }) {
579
579
  value: schema.enum.map((value)=>JSON.stringify(value)).join(' | ')
580
580
  });
581
581
  }
582
- if (fields.length > 0) child.push(/*#__PURE__*/ jsx("p", {
583
- children: fields.map((field, i)=>/*#__PURE__*/ jsxs(Fragment, {
582
+ if (fields.length > 0) child.push(/*#__PURE__*/ jsx("div", {
583
+ className: "flex flex-col gap-2",
584
+ children: fields.map((field)=>/*#__PURE__*/ jsxs("span", {
584
585
  children: [
585
- /*#__PURE__*/ jsxs("span", {
586
- children: [
587
- field.key,
588
- ": ",
589
- /*#__PURE__*/ jsx("code", {
590
- children: field.value
591
- })
592
- ]
593
- }),
594
- i !== fields.length - 1 ? /*#__PURE__*/ jsx("br", {}) : null
586
+ field.key,
587
+ ": ",
588
+ /*#__PURE__*/ jsx("code", {
589
+ children: field.value
590
+ })
595
591
  ]
596
592
  }, field.key))
597
593
  }, "fields"));
@@ -64,7 +64,7 @@ function useSchemaContext() {
64
64
  return ctx;
65
65
  }
66
66
 
67
- const APIPlayground = dynamic(()=>import('./playground-client-CB0L6vUj.js').then((mod)=>mod.APIPlayground));
67
+ const APIPlayground = dynamic(()=>import('./playground-client-CbOYGXy9.js').then((mod)=>mod.APIPlayground));
68
68
  function Root({ children, baseUrl, className, ...props }) {
69
69
  return /*#__PURE__*/ jsx("div", {
70
70
  className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
package/dist/ui/index.js CHANGED
@@ -3,8 +3,8 @@ import { cn } from 'fumadocs-ui/components/api';
3
3
  import { Fragment } from 'react';
4
4
  import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
5
5
  import { cva } from 'class-variance-authority';
6
- import { C as CopyRouteButton } from './client-client-BUlxkJAI.js';
7
- export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-BUlxkJAI.js';
6
+ import { C as CopyRouteButton } from './client-client-CUW5FVMv.js';
7
+ export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-CUW5FVMv.js';
8
8
 
9
9
  const badgeVariants = cva('rounded border px-1.5 py-1 text-xs font-medium leading-[12px]', {
10
10
  variants: {
@@ -6,7 +6,7 @@ import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWa
6
6
  import useSWRImmutable from 'swr/immutable';
7
7
  import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
8
8
  import { cn, buttonVariants } from 'fumadocs-ui/components/api';
9
- import { u as useSchemaContext, a as useApiContext, S as SchemaContext } from './client-client-BUlxkJAI.js';
9
+ import { u as useSchemaContext, a as useApiContext, S as SchemaContext } from './client-client-CUW5FVMv.js';
10
10
  import { Slot } from '@radix-ui/react-slot';
11
11
  import { cva } from 'class-variance-authority';
12
12
  import { CircleCheckIcon, CircleXIcon, ChevronDown, ChevronUp, Check, Trash2, Plus } from 'lucide-react';
@@ -876,11 +876,7 @@ function APIPlayground({ route, method = 'GET', bodyType, authorization, path =
876
876
  bodyType
877
877
  ] : null, async ()=>{
878
878
  if (!input) return;
879
- const url = new URL(`${baseUrl ?? window.location.origin}${createPathnameFromInput(route, input.path)}`);
880
- Object.keys(input.query).forEach((key)=>{
881
- const paramValue = input.query[key];
882
- if (typeof paramValue === 'string' && paramValue.length > 0) url.searchParams.append(key, paramValue);
883
- });
879
+ const url = new URL(`${baseUrl ?? window.location.origin}${createUrlFromInput(route, input.path, input.query)}`);
884
880
  const headers = new Headers({
885
881
  'Content-Type': 'application/json'
886
882
  });
@@ -1011,21 +1007,30 @@ function APIPlayground({ route, method = 'GET', bodyType, authorization, path =
1011
1007
  })
1012
1008
  });
1013
1009
  }
1014
- function createPathnameFromInput(route, input) {
1010
+ function createUrlFromInput(route, path, query) {
1015
1011
  let pathname = route;
1016
- Object.keys(input).forEach((key)=>{
1017
- const paramValue = input[key];
1012
+ Object.keys(path).forEach((key)=>{
1013
+ const paramValue = path[key];
1018
1014
  if (typeof paramValue === 'string' && paramValue.length > 0) pathname = pathname.replace(`{${key}}`, paramValue);
1019
1015
  });
1020
- return pathname;
1016
+ const searchParams = new URLSearchParams();
1017
+ Object.keys(query).forEach((key)=>{
1018
+ const paramValue = query[key];
1019
+ if (typeof paramValue === 'string' && paramValue.length > 0) searchParams.append(key, paramValue);
1020
+ });
1021
+ return searchParams.size > 0 ? `${pathname}?${searchParams.toString()}` : pathname;
1021
1022
  }
1022
1023
  function RouteDisplay({ route }) {
1023
- const pathInput = useWatch({
1024
- name: 'path'
1024
+ const [path, query] = useWatch({
1025
+ name: [
1026
+ 'path',
1027
+ 'query'
1028
+ ]
1025
1029
  });
1026
- const pathname = useMemo(()=>createPathnameFromInput(route, pathInput), [
1030
+ const pathname = useMemo(()=>createUrlFromInput(route, path, query), [
1027
1031
  route,
1028
- pathInput
1032
+ path,
1033
+ query
1029
1034
  ]);
1030
1035
  return /*#__PURE__*/ jsx("code", {
1031
1036
  className: "flex-1 overflow-auto text-nowrap rounded-lg border bg-fd-muted px-2 py-1.5 text-sm text-fd-muted-foreground",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "5.4.1",
3
+ "version": "5.4.3",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -60,8 +60,8 @@
60
60
  "remark": "^15.0.0",
61
61
  "shiki": "^1.13.0",
62
62
  "swr": "^2.2.5",
63
- "fumadocs-core": "13.3.2",
64
- "fumadocs-ui": "13.3.2"
63
+ "fumadocs-core": "13.3.3",
64
+ "fumadocs-ui": "13.3.3"
65
65
  },
66
66
  "devDependencies": {
67
67
  "@types/js-yaml": "^4.0.9",