fumadocs-openapi 5.5.7 → 5.5.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.
@@ -473,9 +473,12 @@ function heading(depth, child, ctx) {
473
473
  * Combine multiple object schemas into one
474
474
  */ function combineSchema(schema) {
475
475
  const result = {
476
- type: 'object'
476
+ type: undefined
477
477
  };
478
478
  function add(s) {
479
+ if (s.type) {
480
+ result.type = result.type ? 'object' : s.type;
481
+ }
479
482
  if (s.properties) {
480
483
  var _result;
481
484
  (_result = result).properties ?? (_result.properties = {});
@@ -493,6 +496,14 @@ function heading(depth, child, ctx) {
493
496
  (_result2 = result).required ?? (_result2.required = []);
494
497
  result.required.push(...s.required);
495
498
  }
499
+ if (s.enum && s.enum.length > 0) {
500
+ var _result3;
501
+ (_result3 = result).enum ?? (_result3.enum = []);
502
+ result.enum.push(...s.enum);
503
+ }
504
+ if (s.nullable) {
505
+ result.nullable = true;
506
+ }
496
507
  if (s.allOf) {
497
508
  noRef(s.allOf).forEach(add);
498
509
  }
@@ -520,7 +531,7 @@ function Schema({ name, schema, ctx }) {
520
531
  const { renderer } = ctx.render;
521
532
  const child = [];
522
533
  // object type
523
- if (isObject(schema) && parseObject) {
534
+ if (isObject(schema) && parseObject && (schema.additionalProperties || schema.properties)) {
524
535
  const { additionalProperties, properties } = schema;
525
536
  if (additionalProperties === true) {
526
537
  child.push(/*#__PURE__*/ jsx(renderer.Property, {
@@ -660,7 +671,16 @@ function getSchemaType(schema, ctx) {
660
671
  if (schema.title) return schema.title;
661
672
  if (schema.type === 'array') return `array<${getSchemaType(noRef(schema.items), ctx)}>`;
662
673
  if (schema.oneOf) return schema.oneOf.map((one)=>getSchemaType(noRef(one), ctx)).join(' | ');
663
- if (schema.allOf) return schema.allOf.map((one)=>getSchemaType(noRef(one), ctx)).join(' & ');
674
+ if (schema.allOf) {
675
+ const allTypeNames = schema.allOf.map((one)=>getSchemaType(noRef(one), ctx));
676
+ const hasNull = allTypeNames.includes('null');
677
+ const nonNullTypes = allTypeNames.filter((v)=>v !== 'null');
678
+ const nonNullTypeNames = nonNullTypes.join(' & ');
679
+ if (!hasNull) return nonNullTypeNames;
680
+ if (nonNullTypes.length === 0) return 'null';
681
+ else if (nonNullTypes.length === 1 || !hasNull) return `${nonNullTypeNames} | null`;
682
+ else return `(${nonNullTypeNames}) | null`;
683
+ }
664
684
  if (schema.not) return `not ${getSchemaType(noRef(schema.not), ctx)}`;
665
685
  if (schema.anyOf) {
666
686
  return `Any properties in ${schema.anyOf.map((one)=>getSchemaType(noRef(one), ctx)).join(', ')}`;
@@ -6,7 +6,7 @@ import dynamic from 'next/dynamic';
6
6
  import { useOnChange } from 'fumadocs-core/utils/use-on-change';
7
7
 
8
8
  /**
9
- * @license lucide-react v0.454.0 - ISC
9
+ * @license lucide-react v0.455.0 - ISC
10
10
  *
11
11
  * This source code is licensed under the ISC license.
12
12
  * See the LICENSE file in the root directory of this source tree.
@@ -16,7 +16,7 @@ const mergeClasses = (...classes)=>classes.filter((className, index, array)=>{
16
16
  }).join(" ").trim();
17
17
 
18
18
  /**
19
- * @license lucide-react v0.454.0 - ISC
19
+ * @license lucide-react v0.455.0 - ISC
20
20
  *
21
21
  * This source code is licensed under the ISC license.
22
22
  * See the LICENSE file in the root directory of this source tree.
@@ -253,7 +253,7 @@ function useSchemaContext() {
253
253
  return ctx;
254
254
  }
255
255
 
256
- const APIPlayground = dynamic(()=>import('./playground-client-DP0uMdBd.js').then((mod)=>mod.APIPlayground));
256
+ const APIPlayground = dynamic(()=>import('./playground-client-CD8aXhkm.js').then((mod)=>mod.APIPlayground));
257
257
  function Root({ children, baseUrl, className, shikiOptions, ...props }) {
258
258
  return /*#__PURE__*/ jsx("div", {
259
259
  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 { f as CopyRouteButton } from './client-client-z1mFtfJE.js';
7
- export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-z1mFtfJE.js';
6
+ import { f as CopyRouteButton } from './client-client-YY5m8QKX.js';
7
+ export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-YY5m8QKX.js';
8
8
 
9
9
  const badgeVariants = cva('rounded-xl border px-1.5 py-1 text-xs font-medium leading-[12px]', {
10
10
  variants: {
@@ -35,7 +35,7 @@ function getBadgeColor(method) {
35
35
  function Route({ route }) {
36
36
  const segments = route.split('/').filter((part)=>part.length > 0);
37
37
  return /*#__PURE__*/ jsx("div", {
38
- className: "not-prose flex flex-row items-center gap-1 overflow-auto text-xs",
38
+ className: "not-prose flex flex-row items-center gap-1 overflow-auto text-nowrap text-xs",
39
39
  children: segments.map((part, index)=>/*#__PURE__*/ jsxs(Fragment, {
40
40
  children: [
41
41
  /*#__PURE__*/ jsx("span", {
@@ -5,7 +5,7 @@ import { forwardRef, useId, createContext, useContext, useState, useCallback, us
5
5
  import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWatch } from 'react-hook-form';
6
6
  import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
7
7
  import { cn, buttonVariants } from 'fumadocs-ui/components/api';
8
- import { C as CircleCheck, a as CircleX, b as ChevronDown, c as ChevronUp, d as Check, u as useSchemaContext, T as Trash2, P as Plus, e as useApiContext, S as SchemaContext } from './client-client-z1mFtfJE.js';
8
+ import { C as CircleCheck, a as CircleX, b as ChevronDown, c as ChevronUp, d as Check, u as useSchemaContext, T as Trash2, P as Plus, e as useApiContext, S as SchemaContext } from './client-client-YY5m8QKX.js';
9
9
  import { Slot } from '@radix-ui/react-slot';
10
10
  import { cva } from 'class-variance-authority';
11
11
  import { useOnChange } from 'fumadocs-core/utils/use-on-change';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "5.5.7",
3
+ "version": "5.5.9",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "NextJs",
@@ -45,17 +45,17 @@
45
45
  "remark": "^15.0.1",
46
46
  "remark-rehype": "^11.1.1",
47
47
  "shiki": "^1.22.2",
48
- "fumadocs-core": "14.2.1",
49
- "fumadocs-ui": "14.2.1"
48
+ "fumadocs-core": "14.3.1",
49
+ "fumadocs-ui": "14.3.1"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/js-yaml": "^4.0.9",
53
- "@types/node": "22.8.6",
53
+ "@types/node": "22.9.0",
54
54
  "@types/openapi-sampler": "^1.0.3",
55
55
  "@types/react": "^18.3.12",
56
56
  "bunchee": "^5.6.1",
57
- "lucide-react": "^0.454.0",
58
- "next": "15.0.2",
57
+ "lucide-react": "^0.455.0",
58
+ "next": "15.0.3",
59
59
  "openapi-types": "^12.1.3",
60
60
  "eslint-config-custom": "0.0.0",
61
61
  "tsconfig": "0.0.0"