fumadocs-openapi 9.0.8 → 9.0.9
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.
- package/dist/playground/client.js +6 -6
- package/dist/playground/inputs.d.ts +1 -2
- package/dist/playground/inputs.d.ts.map +1 -1
- package/dist/playground/inputs.js +8 -5
- package/dist/render/schema.d.ts.map +1 -1
- package/dist/render/schema.js +24 -14
- package/dist/utils/url.d.ts.map +1 -1
- package/dist/utils/url.js +8 -7
- package/package.json +8 -8
|
@@ -169,14 +169,14 @@ function BodyInput({ field: _field }) {
|
|
|
169
169
|
const [isJson, setIsJson] = useState(false);
|
|
170
170
|
if (field.format === 'binary')
|
|
171
171
|
return _jsx(FieldSet, { field: field, fieldName: "body" });
|
|
172
|
-
return (_jsx(_Fragment, { children: isJson ? (
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
172
|
+
return (_jsx(_Fragment, { children: isJson ? (_jsxs(_Fragment, { children: [_jsx("button", { className: cn(buttonVariants({
|
|
173
|
+
color: 'secondary',
|
|
174
|
+
size: 'sm',
|
|
175
|
+
className: 'w-fit font-mono p-2',
|
|
176
|
+
})), onClick: () => setIsJson(false), type: "button", children: "Close JSON Editor" }), _jsx(JsonInput, { fieldName: "body" })] })) : (_jsx(FieldSet, { field: field, fieldName: "body", collapsible: false, name: _jsx("button", { className: cn(buttonVariants({
|
|
177
177
|
color: 'secondary',
|
|
178
178
|
size: 'sm',
|
|
179
|
-
className: '
|
|
179
|
+
className: 'p-2',
|
|
180
180
|
})), onClick: () => setIsJson(true), type: "button", children: "Open JSON Editor" }) })) }));
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
@@ -4,9 +4,8 @@ export declare function ObjectInput({ field: _field, fieldName, ...props }: {
|
|
|
4
4
|
field: Exclude<RequestSchema, boolean>;
|
|
5
5
|
fieldName: string;
|
|
6
6
|
} & ComponentProps<'div'>): import("react/jsx-runtime").JSX.Element | undefined;
|
|
7
|
-
export declare function JsonInput({ fieldName
|
|
7
|
+
export declare function JsonInput({ fieldName }: {
|
|
8
8
|
fieldName: string;
|
|
9
|
-
children: ReactNode;
|
|
10
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
11
10
|
export declare function FieldInput({ field, fieldName, isRequired, ...props }: HTMLAttributes<HTMLElement> & {
|
|
12
11
|
field: Exclude<RequestSchema, boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/playground/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAkDxD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAAC,KAAK,CAAC,uDAwCxB;AAED,wBAAgB,SAAS,CAAC,
|
|
1
|
+
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/playground/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAef,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAkDxD,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EAAE,MAAM,EACb,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,cAAc,CAAC,KAAK,CAAC,uDAwCxB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,2CA8B7D;AA6FD,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,SAAS,EACT,UAAU,EACV,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,KAAK,EAAE,OAAO,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,uDAmFA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EAAE,MAAM,EACb,SAAS,EACT,OAAO,EACP,IAAI,EACJ,UAAU,EACV,KAAS,EACT,QAAQ,EACR,WAAkB,EAClB,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,kDA2KA"}
|
|
@@ -36,20 +36,23 @@ export function ObjectInput({ field: _field, fieldName, ...props }) {
|
|
|
36
36
|
return anyFields;
|
|
37
37
|
} }))] }));
|
|
38
38
|
}
|
|
39
|
-
export function JsonInput({ fieldName
|
|
39
|
+
export function JsonInput({ fieldName }) {
|
|
40
40
|
const controller = useController({
|
|
41
41
|
name: fieldName,
|
|
42
42
|
});
|
|
43
|
+
const [error, setError] = useState(null);
|
|
43
44
|
const [value, setValue] = useState(() => JSON.stringify(controller.field.value, null, 2));
|
|
44
|
-
return (_jsxs("div", { className: "
|
|
45
|
+
return (_jsxs("div", { className: "flex flex-col bg-fd-secondary text-fd-secondary-foreground overflow-hidden border rounded-lg", children: [_jsx("textarea", { ...controller.field, value: value, className: "p-2 h-[240px] text-sm font-mono resize-none focus-visible:outline-none", onChange: (v) => {
|
|
45
46
|
setValue(v.target.value);
|
|
46
47
|
try {
|
|
47
48
|
controller.field.onChange(JSON.parse(v.target.value));
|
|
49
|
+
setError(null);
|
|
48
50
|
}
|
|
49
|
-
catch {
|
|
50
|
-
|
|
51
|
+
catch (e) {
|
|
52
|
+
if (e instanceof Error)
|
|
53
|
+
setError(e.message);
|
|
51
54
|
}
|
|
52
|
-
} })] }));
|
|
55
|
+
} }), _jsx("p", { className: "p-2 text-xs font-mono border-t text-red-400 empty:hidden", children: error })] }));
|
|
53
56
|
}
|
|
54
57
|
function DynamicProperties({ fieldName, filterKey = () => true, getType = () => anyFields, }) {
|
|
55
58
|
const { control, setValue, getValues } = useFormContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/render/schema.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/render/schema.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAe7C,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,MAAM,EACN,QAAgB,EAChB,QAAgB,EAChB,SAAiB,EACjB,EAAe,EACf,GAAG,EAAE,EAAE,QAAQ,EAAE,GAClB,EAAE;IACD,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,cAAc,CAAC;IACvB,EAAE,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC;IAEzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,GAAG,EAAE,aAAa,CAAC;CACpB,GAAG,SAAS,CAoTZ"}
|
package/dist/render/schema.js
CHANGED
|
@@ -4,12 +4,6 @@ import { combineSchema } from '../utils/combine-schema.js';
|
|
|
4
4
|
import { Markdown } from './markdown.js';
|
|
5
5
|
import { schemaToString } from '../utils/schema-to-string.js';
|
|
6
6
|
import { Tabs, TabsContent, TabsList, TabsTrigger, } from 'fumadocs-ui/components/tabs';
|
|
7
|
-
const keys = {
|
|
8
|
-
default: 'Default',
|
|
9
|
-
pattern: 'Pattern',
|
|
10
|
-
format: 'Format',
|
|
11
|
-
multipleOf: 'Multiple of',
|
|
12
|
-
};
|
|
13
7
|
export function Schema({ name, schema, required = false, readOnly = false, writeOnly = false, as = 'property', ctx: { renderer }, }) {
|
|
14
8
|
function propertyBody(schema, renderPrimitive, ctx) {
|
|
15
9
|
if (Array.isArray(schema.type)) {
|
|
@@ -51,13 +45,29 @@ export function Schema({ name, schema, required = false, readOnly = false, write
|
|
|
51
45
|
}
|
|
52
46
|
function propertyInfo(schema) {
|
|
53
47
|
const fields = [];
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
if (schema.default) {
|
|
49
|
+
fields.push({
|
|
50
|
+
key: 'Default',
|
|
51
|
+
value: JSON.stringify(schema.default),
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
if (schema.pattern) {
|
|
55
|
+
fields.push({
|
|
56
|
+
key: 'Match',
|
|
57
|
+
value: schema.pattern,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (schema.format) {
|
|
61
|
+
fields.push({
|
|
62
|
+
key: 'Format',
|
|
63
|
+
value: schema.format,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
if (schema.multipleOf) {
|
|
67
|
+
fields.push({
|
|
68
|
+
key: 'Multiple Of',
|
|
69
|
+
value: String(schema.multipleOf),
|
|
70
|
+
});
|
|
61
71
|
}
|
|
62
72
|
let range = getRange('value', schema.minimum, schema.exclusiveMinimum, schema.maximum, schema.exclusiveMaximum);
|
|
63
73
|
if (range)
|
|
@@ -85,7 +95,7 @@ export function Schema({ name, schema, required = false, readOnly = false, write
|
|
|
85
95
|
}
|
|
86
96
|
if (fields.length === 0)
|
|
87
97
|
return;
|
|
88
|
-
return (_jsx("div", { className: "flex flex-wrap gap-2 not-prose", children: fields.map((field) => (_jsxs("div", { className: "bg-fd-secondary
|
|
98
|
+
return (_jsx("div", { className: "flex flex-wrap gap-2 not-prose", children: fields.map((field) => (_jsxs("div", { className: "bg-fd-secondary border rounded-lg text-xs p-1.5 shadow-md", children: [_jsx("span", { className: "font-medium me-2", children: field.key }), _jsx("code", { className: "text-fd-muted-foreground", children: field.value })] }, field.key))) }));
|
|
89
99
|
}
|
|
90
100
|
function primitiveBody(schema, ctx, collapsible, nested) {
|
|
91
101
|
if (schema.type === 'object') {
|
package/dist/utils/url.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"url.d.ts","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEtD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM9D;AAED;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAM1D;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAChC,MAAM,CAMR;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE,WAAW,GAC3B,MAAM,CAyBR"}
|
package/dist/utils/url.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export function joinURL(base, pathname) {
|
|
2
|
-
|
|
3
|
-
.
|
|
4
|
-
|
|
5
|
-
.
|
|
6
|
-
if (
|
|
7
|
-
base
|
|
8
|
-
|
|
2
|
+
if (pathname.startsWith('/'))
|
|
3
|
+
pathname = pathname.slice(1);
|
|
4
|
+
if (base.endsWith('/'))
|
|
5
|
+
base = base.slice(0, -1);
|
|
6
|
+
if (pathname.length > 0)
|
|
7
|
+
return base + '/' + pathname;
|
|
8
|
+
else
|
|
9
|
+
return base;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* @param url - URL (can be relative)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "9.0.
|
|
3
|
+
"version": "9.0.9",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@radix-ui/react-dialog": "^1.1.14",
|
|
51
51
|
"@radix-ui/react-select": "^2.2.5",
|
|
52
52
|
"@radix-ui/react-slot": "^1.2.3",
|
|
53
|
-
"@scalar/openapi-parser": "0.
|
|
53
|
+
"@scalar/openapi-parser": "0.16.0",
|
|
54
54
|
"ajv": "^8.17.1",
|
|
55
55
|
"class-variance-authority": "^0.7.1",
|
|
56
56
|
"github-slugger": "^2.0.0",
|
|
@@ -58,19 +58,19 @@
|
|
|
58
58
|
"js-yaml": "^4.1.0",
|
|
59
59
|
"next-themes": "^0.4.6",
|
|
60
60
|
"openapi-sampler": "^1.6.1",
|
|
61
|
-
"react-hook-form": "^7.
|
|
61
|
+
"react-hook-form": "^7.57.0",
|
|
62
62
|
"remark": "^15.0.1",
|
|
63
63
|
"remark-rehype": "^11.1.2",
|
|
64
|
-
"shiki": "^3.
|
|
64
|
+
"shiki": "^3.6.0",
|
|
65
65
|
"tinyglobby": "^0.2.14",
|
|
66
66
|
"xml-js": "^1.6.11",
|
|
67
67
|
"fumadocs-core": "15.5.1",
|
|
68
68
|
"fumadocs-ui": "15.5.1"
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
-
"@scalar/api-client-react": "^1.3.
|
|
71
|
+
"@scalar/api-client-react": "^1.3.10",
|
|
72
72
|
"@types/js-yaml": "^4.0.9",
|
|
73
|
-
"@types/node": "22.15.
|
|
73
|
+
"@types/node": "22.15.30",
|
|
74
74
|
"@types/openapi-sampler": "^1.0.3",
|
|
75
75
|
"@types/react": "^19.1.6",
|
|
76
76
|
"json-schema-typed": "^8.0.1",
|
|
@@ -78,8 +78,8 @@
|
|
|
78
78
|
"openapi-types": "^12.1.3",
|
|
79
79
|
"tailwindcss": "^4.1.8",
|
|
80
80
|
"tsc-alias": "^1.8.16",
|
|
81
|
-
"
|
|
82
|
-
"
|
|
81
|
+
"eslint-config-custom": "0.0.0",
|
|
82
|
+
"tsconfig": "0.0.0"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
85
|
"@scalar/api-client-react": "*",
|