fumadocs-openapi 10.3.6 → 10.3.7

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.
@@ -417,6 +417,7 @@
417
417
  @source inline("left-1/2");
418
418
  @source inline("length");
419
419
  @source inline("let");
420
+ @source inline("line-through");
420
421
  @source inline("list");
421
422
  @source inline("listener");
422
423
  @source inline("listeners");
@@ -141,9 +141,9 @@ declare namespace OpenAPIV3_2 {
141
141
  pathItems?: Record<string, ReferenceObject | PathItemObject>;
142
142
  mediaTypes?: Record<string, MediaTypeObject | ReferenceObject>;
143
143
  }>;
144
- export type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | (OpenIdSecurityScheme & {
144
+ export type SecuritySchemeObject = (HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme) & {
145
145
  deprecated?: boolean;
146
- });
146
+ };
147
147
  export type HttpSecurityScheme = OpenAPIV3_1.HttpSecurityScheme;
148
148
  export type ApiKeySecurityScheme = OpenAPIV3_1.ApiKeySecurityScheme;
149
149
  export type OAuthFlows = OpenAPIV3_1.OAuthFlows & {
@@ -31,7 +31,10 @@ function PlaygroundClient({ route, method = "GET", securities, parameters = [],
31
31
  const storageKeys = useStorageKey();
32
32
  const { mediaAdapters, client: { playground: { components: { ResultDisplay = DefaultResultDisplay } = {}, requestTimeout = 10, transformAuthInputs } = {} } } = useApiContext();
33
33
  const { serverRef } = useServerContext();
34
- const [securityId, setSecurityId] = useState(0);
34
+ const [securityId, setSecurityId] = useState(() => {
35
+ const idx = securities.findIndex((s) => s.every((entry) => !entry.deprecated));
36
+ return idx === -1 ? 0 : idx;
37
+ });
35
38
  const { inputs, mapInputs, initAuthValues } = useAuthInputs(securities[securityId], transformAuthInputs);
36
39
  const defaultValues = useMemo(() => {
37
40
  const requestData = examples.find((example) => example.id === exampleId)?.data;
@@ -150,7 +153,7 @@ function SecurityTabs({ securities, setSecurityId, securityId, children }) {
150
153
  children: security.map((item) => /* @__PURE__ */ jsxs("div", {
151
154
  className: "max-w-[600px]",
152
155
  children: [/* @__PURE__ */ jsx("p", {
153
- className: "font-mono font-medium",
156
+ className: cn("font-mono font-medium", item.deprecated && "text-fd-muted-foreground line-through"),
154
157
  children: item.id
155
158
  }), /* @__PURE__ */ jsx("p", {
156
159
  className: "text-fd-muted-foreground whitespace-pre-wrap",
@@ -3,7 +3,7 @@ import { createMethod, methodKeys } from "../../utils/schema.js";
3
3
  import { isMediaTypeSupported } from "../../requests/media/resolve-adapter.js";
4
4
  import "../../requests/media/adapter.js";
5
5
  import { cn } from "../../utils/cn.js";
6
- import { MethodLabel } from "../components/method-label.js";
6
+ import { Badge, MethodLabel } from "../components/method-label.js";
7
7
  import { APIPlayground } from "../../playground/index.js";
8
8
  import { Schema } from "../schema/index.js";
9
9
  import { UsageTabsProviderLazy } from "./usage-tabs/lazy.js";
@@ -370,38 +370,48 @@ function WebhookCallback({ callback, ctx, headingLevel }) {
370
370
  })
371
371
  });
372
372
  }
373
- function AuthScheme({ scheme: schema, scopes, ctx }) {
374
- if (schema.type === "http" || schema.type === "oauth2") return /* @__PURE__ */ jsxs(AuthProperty, {
373
+ function AuthScheme({ scheme, scopes, ctx }) {
374
+ if (scheme.type === "http" || scheme.type === "oauth2") return /* @__PURE__ */ jsxs(AuthProperty, {
375
375
  name: "Authorization",
376
- type: schema.type === "http" && schema.scheme === "basic" ? `Basic <token>` : "Bearer <token>",
376
+ type: scheme.type === "http" && scheme.scheme === "basic" ? `Basic <token>` : "Bearer <token>",
377
+ deprecated: scheme.deprecated,
377
378
  scopes,
378
- children: [schema.description && ctx.renderMarkdown(schema.description), /* @__PURE__ */ jsxs("p", { children: ["In: ", /* @__PURE__ */ jsx("code", { children: "header" })] })]
379
+ children: [scheme.description && ctx.renderMarkdown(scheme.description), /* @__PURE__ */ jsxs("p", { children: ["In: ", /* @__PURE__ */ jsx("code", { children: "header" })] })]
379
380
  });
380
- if (schema.type === "apiKey") return /* @__PURE__ */ jsxs(AuthProperty, {
381
- name: schema.name,
381
+ if (scheme.type === "apiKey") return /* @__PURE__ */ jsxs(AuthProperty, {
382
+ name: scheme.name,
382
383
  type: "<token>",
384
+ deprecated: scheme.deprecated,
383
385
  scopes,
384
- children: [schema.description && ctx.renderMarkdown(schema.description), /* @__PURE__ */ jsxs("p", { children: ["In: ", /* @__PURE__ */ jsx("code", { children: schema.in })] })]
386
+ children: [scheme.description && ctx.renderMarkdown(scheme.description), /* @__PURE__ */ jsxs("p", { children: ["In: ", /* @__PURE__ */ jsx("code", { children: scheme.in })] })]
385
387
  });
386
- if (schema.type === "openIdConnect") return /* @__PURE__ */ jsx(AuthProperty, {
388
+ if (scheme.type === "openIdConnect") return /* @__PURE__ */ jsx(AuthProperty, {
387
389
  name: "OpenID Connect",
388
390
  type: "<token>",
391
+ deprecated: scheme.deprecated,
389
392
  scopes,
390
- children: schema.description && ctx.renderMarkdown(schema.description)
393
+ children: scheme.description && ctx.renderMarkdown(scheme.description)
391
394
  });
392
395
  }
393
- function AuthProperty({ name, type, scopes = [], className, ...props }) {
396
+ function AuthProperty({ name, type, deprecated = false, scopes = [], className, ...props }) {
394
397
  return /* @__PURE__ */ jsxs("div", {
395
398
  className: cn("text-sm border-t my-4 first:border-t-0", className),
396
399
  children: [/* @__PURE__ */ jsxs("div", {
397
400
  className: "flex flex-wrap items-center gap-3 not-prose",
398
- children: [/* @__PURE__ */ jsx("span", {
399
- className: "font-medium font-mono text-fd-primary",
400
- children: name
401
- }), /* @__PURE__ */ jsx("span", {
402
- className: "text-sm font-mono text-fd-muted-foreground",
403
- children: type
404
- })]
401
+ children: [
402
+ /* @__PURE__ */ jsx("span", {
403
+ className: "font-medium font-mono text-fd-primary",
404
+ children: name
405
+ }),
406
+ /* @__PURE__ */ jsx("span", {
407
+ className: "text-sm font-mono text-fd-muted-foreground",
408
+ children: type
409
+ }),
410
+ deprecated && /* @__PURE__ */ jsx(Badge, {
411
+ color: "red",
412
+ children: "Deprecated"
413
+ })
414
+ ]
405
415
  }), /* @__PURE__ */ jsxs("div", {
406
416
  className: "prose-no-margin pt-2.5 empty:hidden",
407
417
  children: [props.children, scopes.length > 0 && /* @__PURE__ */ jsxs("p", { children: ["Scope: ", /* @__PURE__ */ jsx("code", { children: scopes.join(", ") })] })]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fumadocs-openapi",
3
- "version": "10.3.6",
3
+ "version": "10.3.7",
4
4
  "description": "Generate MDX docs for your OpenAPI spec",
5
5
  "keywords": [
6
6
  "Docs",
@@ -90,8 +90,8 @@
90
90
  "tsdown": "^0.20.3",
91
91
  "@fumadocs/tailwind": "0.0.2",
92
92
  "eslint-config-custom": "0.0.0",
93
- "fumadocs-core": "16.6.3",
94
- "fumadocs-ui": "16.6.3",
93
+ "fumadocs-core": "16.6.4",
94
+ "fumadocs-ui": "16.6.4",
95
95
  "tsconfig": "0.0.0"
96
96
  },
97
97
  "peerDependencies": {