zudoku 0.38.0 → 0.39.0
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/app/tailwind.js +14 -0
- package/dist/app/tailwind.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Layout.js +2 -9
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Main.js +3 -1
- package/dist/lib/components/Main.js.map +1 -1
- package/dist/lib/components/Pagination.d.ts +10 -0
- package/dist/lib/components/Pagination.js +10 -0
- package/dist/lib/components/Pagination.js.map +1 -0
- package/dist/lib/components/TopNavigation.js +18 -2
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.d.ts +1 -0
- package/dist/lib/components/navigation/SidebarItem.js +7 -3
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/{plugins/markdown → components/navigation}/Toc.js +5 -7
- package/dist/lib/components/navigation/Toc.js.map +1 -0
- package/dist/lib/oas/graphql/index.d.ts +2 -1
- package/dist/lib/oas/graphql/index.js +74 -14
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/dereference/index.js +2 -0
- package/dist/lib/oas/parser/dereference/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +5 -3
- package/dist/lib/oas/parser/index.js +0 -22
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-catalog/index.js +19 -17
- package/dist/lib/plugins/api-catalog/index.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +3 -3
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.d.ts +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +28 -8
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +2 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaList.d.ts +1 -0
- package/dist/lib/plugins/openapi/SchemaList.js +52 -0
- package/dist/lib/plugins/openapi/SchemaList.js.map +1 -0
- package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +1 -1
- package/dist/lib/plugins/openapi/client/GraphQLClient.js +1 -1
- package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -1
- package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +6 -2
- package/dist/lib/plugins/openapi/client/useCreateQuery.js +5 -5
- package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
- package/dist/lib/plugins/openapi/components/EnumValues.js +1 -1
- package/dist/lib/plugins/openapi/components/EnumValues.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
- package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +67 -11
- package/dist/lib/plugins/openapi/graphql/graphql.js +34 -5
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +12 -0
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.d.ts +1 -2
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js +2 -2
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.d.ts +0 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js +1 -1
- package/dist/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.d.ts +4 -0
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +12 -0
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -0
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.d.ts +2 -4
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js +12 -9
- package/dist/lib/plugins/openapi/schema/SchemaPropertyItem.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -2
- package/dist/lib/plugins/openapi/schema/SchemaView.js +30 -52
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +1 -0
- package/dist/lib/plugins/openapi/schema/utils.js +3 -1
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js +9 -3
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/util/useOnScreen.d.ts +3 -2
- package/dist/lib/util/useOnScreen.js +3 -3
- package/dist/lib/util/useOnScreen.js.map +1 -1
- package/dist/vite/api/schema-codegen.js +2 -2
- package/dist/vite/api/schema-codegen.js.map +1 -1
- package/dist/vite/api/schema-codegen.test.js +5 -0
- package/dist/vite/api/schema-codegen.test.js.map +1 -1
- package/dist/vite/plugin-api.js +8 -7
- package/dist/vite/plugin-api.js.map +1 -1
- package/lib/{AuthenticationPlugin-Duy_R1TU.js → AuthenticationPlugin-foqdvvkf.js} +2 -2
- package/lib/{AuthenticationPlugin-Duy_R1TU.js.map → AuthenticationPlugin-foqdvvkf.js.map} +1 -1
- package/lib/{Callout-B2vsR09t.js → Callout-D5frCCJ0.js} +2 -2
- package/lib/{Callout-B2vsR09t.js.map → Callout-D5frCCJ0.js.map} +1 -1
- package/lib/{Dialog-sbgekbjb.js → Dialog-Dv6WG8RN.js} +5 -5
- package/lib/{Dialog-sbgekbjb.js.map → Dialog-Dv6WG8RN.js.map} +1 -1
- package/lib/{Markdown-DIZ8nBVC.js → Markdown-aF5FdsNi.js} +1339 -1335
- package/lib/{Markdown-DIZ8nBVC.js.map → Markdown-aF5FdsNi.js.map} +1 -1
- package/lib/MdxPage-ZW1StNhp.js +83 -0
- package/lib/MdxPage-ZW1StNhp.js.map +1 -0
- package/lib/{OasProvider-D1A10JeA.js → OasProvider-Cld9RAMQ.js} +3 -3
- package/lib/{OasProvider-D1A10JeA.js.map → OasProvider-Cld9RAMQ.js.map} +1 -1
- package/lib/OperationList-D-OfzJm6.js +5065 -0
- package/lib/OperationList-D-OfzJm6.js.map +1 -0
- package/lib/Pagination-CYB3nVYx.js +46 -0
- package/lib/Pagination-CYB3nVYx.js.map +1 -0
- package/lib/SchemaList-Ci1WxRh0.js +148 -0
- package/lib/SchemaList-Ci1WxRh0.js.map +1 -0
- package/lib/SchemaView-Brn-YxHY.js +345 -0
- package/lib/SchemaView-Brn-YxHY.js.map +1 -0
- package/lib/{Select-fAYcJ0OU.js → Select-DVFRKf1R.js} +3 -3
- package/lib/{Select-fAYcJ0OU.js.map → Select-DVFRKf1R.js.map} +1 -1
- package/lib/{SlotletProvider-BEwNY8q0.js → SlotletProvider-DXvc0aY6.js} +2 -2
- package/lib/{SlotletProvider-BEwNY8q0.js.map → SlotletProvider-DXvc0aY6.js.map} +1 -1
- package/lib/Toc-YBsgI72s.js +92 -0
- package/lib/Toc-YBsgI72s.js.map +1 -0
- package/lib/{createServer-DjgKDpGV.js → createServer-mMau3eV_.js} +1732 -1664
- package/lib/{createServer-DjgKDpGV.js.map → createServer-mMau3eV_.js.map} +1 -1
- package/lib/{hook-Cge6LiTK.js → hook-CqpVYDqN.js} +28 -28
- package/lib/{hook-Cge6LiTK.js.map → hook-CqpVYDqN.js.map} +1 -1
- package/lib/index-Bt7MKhZq.js +2514 -0
- package/lib/index-Bt7MKhZq.js.map +1 -0
- package/lib/{index-B0y3fTg-.js → index-CjPMxpOV.js} +771 -730
- package/lib/index-CjPMxpOV.js.map +1 -0
- package/lib/{mutation-EChriCeF.js → mutation-8LjrN7uz.js} +2 -2
- package/lib/{mutation-EChriCeF.js.map → mutation-8LjrN7uz.js.map} +1 -1
- package/lib/ui/Command.js +1 -1
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +2 -2
- package/lib/zudoku.components.js +31 -1454
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +1 -1
- package/lib/zudoku.plugin-api-catalog.js +80 -77
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +3 -3
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +2 -2
- package/lib/zudoku.plugin-search-pagefind.js +3 -3
- package/package.json +4 -3
- package/src/app/tailwind.ts +14 -0
- package/src/lib/components/Layout.tsx +4 -16
- package/src/lib/components/Main.tsx +3 -1
- package/src/lib/components/Pagination.tsx +47 -0
- package/src/lib/components/TopNavigation.tsx +29 -2
- package/src/lib/components/navigation/SidebarItem.tsx +10 -4
- package/src/lib/{plugins/markdown → components/navigation}/Toc.tsx +5 -14
- package/src/lib/oas/graphql/index.ts +118 -45
- package/src/lib/oas/parser/dereference/index.ts +2 -0
- package/src/lib/oas/parser/index.ts +7 -29
- package/src/lib/plugins/api-catalog/index.tsx +40 -35
- package/src/lib/plugins/markdown/MdxPage.tsx +6 -36
- package/src/lib/plugins/openapi/ColorizedParam.tsx +1 -1
- package/src/lib/plugins/openapi/OperationList.tsx +36 -15
- package/src/lib/plugins/openapi/OperationListItem.tsx +7 -2
- package/src/lib/plugins/openapi/ParameterListItem.tsx +2 -0
- package/src/lib/plugins/openapi/SchemaList.tsx +151 -0
- package/src/lib/plugins/openapi/client/GraphQLClient.tsx +1 -1
- package/src/lib/plugins/openapi/client/useCreateQuery.ts +12 -5
- package/src/lib/plugins/openapi/components/EnumValues.tsx +1 -1
- package/src/lib/plugins/openapi/graphql/gql.ts +15 -6
- package/src/lib/plugins/openapi/graphql/graphql.ts +104 -15
- package/src/lib/plugins/openapi/index.tsx +13 -0
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroup.tsx +1 -8
- package/src/lib/plugins/openapi/schema/LogicalGroup/LogicalGroupItem.tsx +1 -2
- package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +36 -0
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +20 -21
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +69 -141
- package/src/lib/plugins/openapi/schema/utils.ts +7 -1
- package/src/lib/plugins/openapi/util/getRoutes.tsx +9 -6
- package/src/lib/util/useOnScreen.ts +6 -4
- package/dist/lib/plugins/markdown/Toc.js.map +0 -1
- package/lib/MdxPage-JEdbfW-f.js +0 -195
- package/lib/MdxPage-JEdbfW-f.js.map +0 -1
- package/lib/OperationList-yOmYzMIp.js +0 -5379
- package/lib/OperationList-yOmYzMIp.js.map +0 -1
- package/lib/index-B0y3fTg-.js.map +0 -1
- package/lib/index.esm-CltAN0Tf.js +0 -711
- package/lib/index.esm-CltAN0Tf.js.map +0 -1
- /package/dist/lib/{plugins/markdown → components/navigation}/Toc.d.ts +0 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import slugify from "@sindresorhus/slugify";
|
|
2
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
3
|
+
import {
|
|
4
|
+
ChevronRightIcon,
|
|
5
|
+
ChevronsDownUpIcon,
|
|
6
|
+
ChevronsUpDownIcon,
|
|
7
|
+
} from "lucide-react";
|
|
8
|
+
import { Button } from "zudoku/ui/Button.js";
|
|
9
|
+
import {
|
|
10
|
+
Collapsible,
|
|
11
|
+
CollapsibleContent,
|
|
12
|
+
CollapsibleTrigger,
|
|
13
|
+
} from "zudoku/ui/Collapsible.js";
|
|
14
|
+
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
15
|
+
import { Heading } from "../../components/Heading.js";
|
|
16
|
+
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
17
|
+
import { Toc } from "../../components/navigation/Toc.js";
|
|
18
|
+
import { cn } from "../../util/cn.js";
|
|
19
|
+
import { useCreateQuery } from "./client/useCreateQuery.js";
|
|
20
|
+
import { useOasConfig } from "./context.js";
|
|
21
|
+
import { graphql } from "./graphql/gql.js";
|
|
22
|
+
import { SchemaView } from "./schema/SchemaView.js";
|
|
23
|
+
|
|
24
|
+
const GET_SCHEMAS = graphql(/* GraphQL */ `
|
|
25
|
+
query GetSchemas($input: JSON!, $type: SchemaType!) {
|
|
26
|
+
schema(input: $input, type: $type) {
|
|
27
|
+
title
|
|
28
|
+
description
|
|
29
|
+
summary
|
|
30
|
+
components {
|
|
31
|
+
schemas {
|
|
32
|
+
name
|
|
33
|
+
schema
|
|
34
|
+
extensions
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
`);
|
|
40
|
+
|
|
41
|
+
export function SchemaList() {
|
|
42
|
+
const { input, type, versions, version, options } = useOasConfig();
|
|
43
|
+
const schemasQuery = useCreateQuery(GET_SCHEMAS, {
|
|
44
|
+
input,
|
|
45
|
+
type,
|
|
46
|
+
});
|
|
47
|
+
const { data } = useSuspenseQuery(schemasQuery);
|
|
48
|
+
|
|
49
|
+
const schemas = data.schema.components?.schemas ?? [];
|
|
50
|
+
|
|
51
|
+
if (!schemas.length) {
|
|
52
|
+
return <div>No schemas found</div>;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const hasMultipleVersions = Object.entries(versions).length > 1;
|
|
56
|
+
const showVersions =
|
|
57
|
+
options?.showVersionSelect === "always" ||
|
|
58
|
+
(hasMultipleVersions && options?.showVersionSelect !== "hide");
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<div
|
|
62
|
+
className="grid grid-cols-[--sidecar-grid-cols] gap-8 justify-between"
|
|
63
|
+
data-pagefind-filter="section:openapi"
|
|
64
|
+
data-pagefind-meta="section:openapi"
|
|
65
|
+
>
|
|
66
|
+
<div className="pt-[--padding-content-top] pb-[--padding-content-bottom]">
|
|
67
|
+
<Collapsible className="w-full">
|
|
68
|
+
<div className="flex flex-col gap-y-4 sm:flex-row justify-around items-start sm:items-end">
|
|
69
|
+
<div className="flex-1">
|
|
70
|
+
<CategoryHeading>{data.schema.title}</CategoryHeading>
|
|
71
|
+
<Heading
|
|
72
|
+
level={1}
|
|
73
|
+
id="schemas"
|
|
74
|
+
registerSidebarAnchor
|
|
75
|
+
className="mb-0"
|
|
76
|
+
>
|
|
77
|
+
Schemas
|
|
78
|
+
{showVersions && (
|
|
79
|
+
<span className="text-xl text-muted-foreground ml-1.5">
|
|
80
|
+
({version})
|
|
81
|
+
</span>
|
|
82
|
+
)}
|
|
83
|
+
</Heading>
|
|
84
|
+
</div>
|
|
85
|
+
{data.schema.description && (
|
|
86
|
+
<CollapsibleTrigger className="flex items-center gap-1 text-sm font-medium text-muted-foreground group">
|
|
87
|
+
<span>API information</span>
|
|
88
|
+
<ChevronsUpDownIcon
|
|
89
|
+
className="group-data-[state=open]:hidden translate-y-px"
|
|
90
|
+
size={14}
|
|
91
|
+
/>
|
|
92
|
+
<ChevronsDownUpIcon
|
|
93
|
+
className="group-data-[state=closed]:hidden translate-y-px"
|
|
94
|
+
size={13}
|
|
95
|
+
/>
|
|
96
|
+
</CollapsibleTrigger>
|
|
97
|
+
)}
|
|
98
|
+
</div>
|
|
99
|
+
{data.schema.description && (
|
|
100
|
+
<CollapsibleContent className="CollapsibleContent">
|
|
101
|
+
<div
|
|
102
|
+
className={cn(
|
|
103
|
+
ProseClasses,
|
|
104
|
+
"pt-4 max-w-full prose-img:max-w-prose",
|
|
105
|
+
)}
|
|
106
|
+
>
|
|
107
|
+
<Markdown
|
|
108
|
+
className="border rounded bg-muted/25 border-border px-2.5 md:px-4"
|
|
109
|
+
content={data.schema.description}
|
|
110
|
+
/>
|
|
111
|
+
</div>
|
|
112
|
+
</CollapsibleContent>
|
|
113
|
+
)}
|
|
114
|
+
</Collapsible>
|
|
115
|
+
<hr className="my-8" />
|
|
116
|
+
<div className="flex flex-col gap-y-5">
|
|
117
|
+
{schemas.map((schema) => (
|
|
118
|
+
<Collapsible key={schema.name} className="group" defaultOpen>
|
|
119
|
+
<Heading
|
|
120
|
+
registerSidebarAnchor
|
|
121
|
+
level={2}
|
|
122
|
+
className="flex items-center gap-1 justify-between w-fit"
|
|
123
|
+
id={slugify(schema.name)}
|
|
124
|
+
>
|
|
125
|
+
{schema.name}{" "}
|
|
126
|
+
<CollapsibleTrigger asChild>
|
|
127
|
+
<Button variant="ghost" size="icon" className="size-6">
|
|
128
|
+
<ChevronRightIcon
|
|
129
|
+
size={16}
|
|
130
|
+
className="group-data-[state=open]:rotate-90 transition cursor-pointer"
|
|
131
|
+
/>
|
|
132
|
+
</Button>
|
|
133
|
+
</CollapsibleTrigger>
|
|
134
|
+
</Heading>
|
|
135
|
+
<CollapsibleContent className="mt-4 CollapsibleContent">
|
|
136
|
+
<SchemaView schema={schema.schema} />
|
|
137
|
+
</CollapsibleContent>
|
|
138
|
+
</Collapsible>
|
|
139
|
+
))}
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
<Toc
|
|
143
|
+
entries={schemas.map((schema) => ({
|
|
144
|
+
id: slugify(schema.name),
|
|
145
|
+
value: schema.name,
|
|
146
|
+
depth: 1,
|
|
147
|
+
}))}
|
|
148
|
+
/>
|
|
149
|
+
</div>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
@@ -43,7 +43,7 @@ export class GraphQLClient {
|
|
|
43
43
|
|
|
44
44
|
fetch = async <TResult, TVariables>(
|
|
45
45
|
query: TypedDocumentString<TResult, TVariables>,
|
|
46
|
-
|
|
46
|
+
variables?: TVariables,
|
|
47
47
|
): Promise<TResult> => {
|
|
48
48
|
const operationName = query.match(/query (\w+)/)?.[1];
|
|
49
49
|
|
|
@@ -1,19 +1,26 @@
|
|
|
1
1
|
import { stripIgnoredCharacters } from "graphql";
|
|
2
|
-
import {
|
|
2
|
+
import { use } from "react";
|
|
3
3
|
import type { TypedDocumentString } from "../graphql/graphql.js";
|
|
4
4
|
import { GraphQLContext } from "./GraphQLContext.js";
|
|
5
5
|
|
|
6
|
+
type NoExtraProps<T, U extends T = T> = U & {
|
|
7
|
+
[K in Exclude<keyof U, keyof T>]?: never;
|
|
8
|
+
};
|
|
9
|
+
|
|
6
10
|
export const useCreateQuery = <TResult, TVariables>(
|
|
7
11
|
query: TypedDocumentString<TResult, TVariables>,
|
|
8
|
-
...variables: TVariables extends Record<string, never>
|
|
12
|
+
...[variables]: TVariables extends Record<string, never>
|
|
13
|
+
? []
|
|
14
|
+
: [NoExtraProps<TVariables>]
|
|
9
15
|
) => {
|
|
10
|
-
const graphQLClient =
|
|
16
|
+
const graphQLClient = use(GraphQLContext);
|
|
17
|
+
|
|
11
18
|
if (graphQLClient === undefined) {
|
|
12
19
|
throw new Error("useGraphQL must be used within a GraphQLProvider");
|
|
13
20
|
}
|
|
14
21
|
|
|
15
22
|
return {
|
|
16
|
-
queryFn: () => graphQLClient.fetch(query,
|
|
17
|
-
queryKey: [stripIgnoredCharacters(query.toString()), variables
|
|
23
|
+
queryFn: () => graphQLClient.fetch(query, variables),
|
|
24
|
+
queryKey: [stripIgnoredCharacters(query.toString()), variables],
|
|
18
25
|
} as const;
|
|
19
26
|
};
|
|
@@ -26,7 +26,7 @@ export const EnumValues = ({
|
|
|
26
26
|
<span className="text-muted-foreground">Enum values: </span>
|
|
27
27
|
{visibleValues.map((value) => (
|
|
28
28
|
<div key={value}>
|
|
29
|
-
<SelectOnClick className="border rounded px-1 font-mono
|
|
29
|
+
<SelectOnClick className="border rounded px-1 font-mono">
|
|
30
30
|
{value}
|
|
31
31
|
</SelectOnClick>
|
|
32
32
|
</div>
|
|
@@ -16,9 +16,10 @@ type Documents = {
|
|
|
16
16
|
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.ServersQueryDocument;
|
|
17
17
|
"\n fragment OperationsFragment on OperationItem {\n slug\n summary\n method\n description\n operationId\n contentTypes\n path\n deprecated\n extensions\n parameters {\n name\n in\n description\n required\n schema\n style\n explode\n examples {\n name\n description\n externalValue\n value\n summary\n }\n }\n requestBody {\n content {\n mediaType\n encoding {\n name\n }\n examples {\n name\n description\n externalValue\n value\n summary\n }\n schema\n }\n description\n required\n }\n responses {\n statusCode\n links\n description\n content {\n examples {\n name\n description\n externalValue\n value\n summary\n }\n mediaType\n encoding {\n name\n }\n schema\n }\n }\n }\n": typeof types.OperationsFragmentFragmentDoc;
|
|
18
18
|
"\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n": typeof types.SchemaWarmupDocument;
|
|
19
|
-
"\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n
|
|
19
|
+
"\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tag(slug: $tag, untagged: $untagged) {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n next {\n name\n slug\n }\n prev {\n name\n slug\n }\n }\n }\n }\n": typeof types.OperationsForTagDocument;
|
|
20
|
+
"\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n": typeof types.GetSchemasDocument;
|
|
20
21
|
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.GetServerQueryDocument;
|
|
21
|
-
"\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n": typeof types.GetSidebarOperationsDocument;
|
|
22
|
+
"\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n": typeof types.GetSidebarOperationsDocument;
|
|
22
23
|
};
|
|
23
24
|
const documents: Documents = {
|
|
24
25
|
"\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
@@ -27,11 +28,13 @@ const documents: Documents = {
|
|
|
27
28
|
types.OperationsFragmentFragmentDoc,
|
|
28
29
|
"\n query SchemaWarmup($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n openapi\n }\n }\n":
|
|
29
30
|
types.SchemaWarmupDocument,
|
|
30
|
-
"\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n
|
|
31
|
+
"\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tag(slug: $tag, untagged: $untagged) {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n next {\n name\n slug\n }\n prev {\n name\n slug\n }\n }\n }\n }\n":
|
|
31
32
|
types.OperationsForTagDocument,
|
|
33
|
+
"\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n":
|
|
34
|
+
types.GetSchemasDocument,
|
|
32
35
|
"\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
|
|
33
36
|
types.GetServerQueryDocument,
|
|
34
|
-
"\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n":
|
|
37
|
+
"\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n":
|
|
35
38
|
types.GetSidebarOperationsDocument,
|
|
36
39
|
};
|
|
37
40
|
|
|
@@ -57,8 +60,14 @@ export function graphql(
|
|
|
57
60
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
58
61
|
*/
|
|
59
62
|
export function graphql(
|
|
60
|
-
source: "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n
|
|
63
|
+
source: "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tag(slug: $tag, untagged: $untagged) {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n next {\n name\n slug\n }\n prev {\n name\n slug\n }\n }\n }\n }\n",
|
|
61
64
|
): typeof import("./graphql.js").OperationsForTagDocument;
|
|
65
|
+
/**
|
|
66
|
+
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
67
|
+
*/
|
|
68
|
+
export function graphql(
|
|
69
|
+
source: "\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n",
|
|
70
|
+
): typeof import("./graphql.js").GetSchemasDocument;
|
|
62
71
|
/**
|
|
63
72
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
64
73
|
*/
|
|
@@ -69,7 +78,7 @@ export function graphql(
|
|
|
69
78
|
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
|
|
70
79
|
*/
|
|
71
80
|
export function graphql(
|
|
72
|
-
source: "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n }\n }\n",
|
|
81
|
+
source: "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n",
|
|
73
82
|
): typeof import("./graphql.js").GetSidebarOperationsDocument;
|
|
74
83
|
|
|
75
84
|
export function graphql(source: string) {
|
|
@@ -35,6 +35,11 @@ export type Scalars = {
|
|
|
35
35
|
JSONSchema: { input: any; output: any };
|
|
36
36
|
};
|
|
37
37
|
|
|
38
|
+
export type Components = {
|
|
39
|
+
__typename?: "Components";
|
|
40
|
+
schemas?: Maybe<Array<SchemaItem>>;
|
|
41
|
+
};
|
|
42
|
+
|
|
38
43
|
export type EncodingItem = {
|
|
39
44
|
__typename?: "EncodingItem";
|
|
40
45
|
allowReserved?: Maybe<Scalars["Boolean"]["output"]>;
|
|
@@ -132,6 +137,7 @@ export type ResponseItem = {
|
|
|
132
137
|
|
|
133
138
|
export type Schema = {
|
|
134
139
|
__typename?: "Schema";
|
|
140
|
+
components?: Maybe<Components>;
|
|
135
141
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
136
142
|
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
137
143
|
openapi: Scalars["String"]["output"];
|
|
@@ -139,6 +145,7 @@ export type Schema = {
|
|
|
139
145
|
paths: Array<PathItem>;
|
|
140
146
|
servers: Array<Server>;
|
|
141
147
|
summary?: Maybe<Scalars["String"]["output"]>;
|
|
148
|
+
tag?: Maybe<SchemaTag>;
|
|
142
149
|
tags: Array<SchemaTag>;
|
|
143
150
|
title: Scalars["String"]["output"];
|
|
144
151
|
url?: Maybe<Scalars["String"]["output"]>;
|
|
@@ -153,16 +160,28 @@ export type SchemaOperationsArgs = {
|
|
|
153
160
|
untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
154
161
|
};
|
|
155
162
|
|
|
156
|
-
export type
|
|
163
|
+
export type SchemaTagArgs = {
|
|
157
164
|
name?: InputMaybe<Scalars["String"]["input"]>;
|
|
165
|
+
slug?: InputMaybe<Scalars["String"]["input"]>;
|
|
166
|
+
untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export type SchemaItem = {
|
|
170
|
+
__typename?: "SchemaItem";
|
|
171
|
+
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
172
|
+
name: Scalars["String"]["output"];
|
|
173
|
+
schema: Scalars["JSONSchema"]["output"];
|
|
158
174
|
};
|
|
159
175
|
|
|
160
176
|
export type SchemaTag = {
|
|
161
177
|
__typename?: "SchemaTag";
|
|
162
178
|
description?: Maybe<Scalars["String"]["output"]>;
|
|
163
179
|
extensions?: Maybe<Scalars["JSONObject"]["output"]>;
|
|
180
|
+
isUntagged: Scalars["Boolean"]["output"];
|
|
164
181
|
name?: Maybe<Scalars["String"]["output"]>;
|
|
182
|
+
next?: Maybe<SchemaTag>;
|
|
165
183
|
operations: Array<OperationItem>;
|
|
184
|
+
prev?: Maybe<SchemaTag>;
|
|
166
185
|
slug?: Maybe<Scalars["String"]["output"]>;
|
|
167
186
|
};
|
|
168
187
|
|
|
@@ -292,18 +311,52 @@ export type OperationsForTagQuery = {
|
|
|
292
311
|
url?: string | null;
|
|
293
312
|
version: string;
|
|
294
313
|
servers: Array<{ __typename?: "Server"; url: string }>;
|
|
295
|
-
|
|
314
|
+
tag?: {
|
|
296
315
|
__typename?: "SchemaTag";
|
|
297
316
|
name?: string | null;
|
|
298
317
|
description?: string | null;
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
|
|
318
|
+
operations: Array<
|
|
319
|
+
{ __typename?: "OperationItem"; slug: string } & {
|
|
320
|
+
" $fragmentRefs"?: {
|
|
321
|
+
OperationsFragmentFragment: OperationsFragmentFragment;
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
>;
|
|
325
|
+
next?: {
|
|
326
|
+
__typename?: "SchemaTag";
|
|
327
|
+
name?: string | null;
|
|
328
|
+
slug?: string | null;
|
|
329
|
+
} | null;
|
|
330
|
+
prev?: {
|
|
331
|
+
__typename?: "SchemaTag";
|
|
332
|
+
name?: string | null;
|
|
333
|
+
slug?: string | null;
|
|
334
|
+
} | null;
|
|
335
|
+
} | null;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
|
|
339
|
+
export type GetSchemasQueryVariables = Exact<{
|
|
340
|
+
input: Scalars["JSON"]["input"];
|
|
341
|
+
type: SchemaType;
|
|
342
|
+
}>;
|
|
343
|
+
|
|
344
|
+
export type GetSchemasQuery = {
|
|
345
|
+
__typename?: "Query";
|
|
346
|
+
schema: {
|
|
347
|
+
__typename?: "Schema";
|
|
348
|
+
title: string;
|
|
349
|
+
description?: string | null;
|
|
350
|
+
summary?: string | null;
|
|
351
|
+
components?: {
|
|
352
|
+
__typename?: "Components";
|
|
353
|
+
schemas?: Array<{
|
|
354
|
+
__typename?: "SchemaItem";
|
|
355
|
+
name: string;
|
|
356
|
+
schema: any;
|
|
357
|
+
extensions?: any | null;
|
|
358
|
+
}> | null;
|
|
359
|
+
} | null;
|
|
307
360
|
};
|
|
308
361
|
};
|
|
309
362
|
|
|
@@ -344,6 +397,10 @@ export type GetSidebarOperationsQuery = {
|
|
|
344
397
|
path: string;
|
|
345
398
|
}>;
|
|
346
399
|
}>;
|
|
400
|
+
components?: {
|
|
401
|
+
__typename?: "Components";
|
|
402
|
+
schemas?: Array<{ __typename: "SchemaItem" }> | null;
|
|
403
|
+
} | null;
|
|
347
404
|
};
|
|
348
405
|
};
|
|
349
406
|
|
|
@@ -468,13 +525,21 @@ export const OperationsForTagDocument = new TypedDocumentString(`
|
|
|
468
525
|
title
|
|
469
526
|
url
|
|
470
527
|
version
|
|
471
|
-
|
|
528
|
+
tag(slug: $tag, untagged: $untagged) {
|
|
472
529
|
name
|
|
473
530
|
description
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
531
|
+
operations {
|
|
532
|
+
slug
|
|
533
|
+
...OperationsFragment
|
|
534
|
+
}
|
|
535
|
+
next {
|
|
536
|
+
name
|
|
537
|
+
slug
|
|
538
|
+
}
|
|
539
|
+
prev {
|
|
540
|
+
name
|
|
541
|
+
slug
|
|
542
|
+
}
|
|
478
543
|
}
|
|
479
544
|
}
|
|
480
545
|
}
|
|
@@ -545,6 +610,25 @@ export const OperationsForTagDocument = new TypedDocumentString(`
|
|
|
545
610
|
OperationsForTagQuery,
|
|
546
611
|
OperationsForTagQueryVariables
|
|
547
612
|
>;
|
|
613
|
+
export const GetSchemasDocument = new TypedDocumentString(`
|
|
614
|
+
query GetSchemas($input: JSON!, $type: SchemaType!) {
|
|
615
|
+
schema(input: $input, type: $type) {
|
|
616
|
+
title
|
|
617
|
+
description
|
|
618
|
+
summary
|
|
619
|
+
components {
|
|
620
|
+
schemas {
|
|
621
|
+
name
|
|
622
|
+
schema
|
|
623
|
+
extensions
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
`) as unknown as TypedDocumentString<
|
|
629
|
+
GetSchemasQuery,
|
|
630
|
+
GetSchemasQueryVariables
|
|
631
|
+
>;
|
|
548
632
|
export const GetServerQueryDocument = new TypedDocumentString(`
|
|
549
633
|
query getServerQuery($input: JSON!, $type: SchemaType!) {
|
|
550
634
|
schema(input: $input, type: $type) {
|
|
@@ -573,6 +657,11 @@ export const GetSidebarOperationsDocument = new TypedDocumentString(`
|
|
|
573
657
|
path
|
|
574
658
|
}
|
|
575
659
|
}
|
|
660
|
+
components {
|
|
661
|
+
schemas {
|
|
662
|
+
__typename
|
|
663
|
+
}
|
|
664
|
+
}
|
|
576
665
|
}
|
|
577
666
|
}
|
|
578
667
|
`) as unknown as TypedDocumentString<
|
|
@@ -29,6 +29,11 @@ const GetSidebarOperationsQuery = graphql(`
|
|
|
29
29
|
path
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
+
components {
|
|
33
|
+
schemas {
|
|
34
|
+
__typename
|
|
35
|
+
}
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
}
|
|
34
39
|
`);
|
|
@@ -168,6 +173,14 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
|
|
|
168
173
|
);
|
|
169
174
|
}
|
|
170
175
|
|
|
176
|
+
if (data.schema.components?.schemas?.length) {
|
|
177
|
+
categories.push({
|
|
178
|
+
type: "link" as const,
|
|
179
|
+
label: "Schemas",
|
|
180
|
+
href: joinUrl(basePath, versionParam, "~schemas"),
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
|
|
171
184
|
return categories;
|
|
172
185
|
} catch {
|
|
173
186
|
return [];
|
|
@@ -15,14 +15,12 @@ export const LogicalGroup = ({
|
|
|
15
15
|
schemas,
|
|
16
16
|
type,
|
|
17
17
|
isOpen,
|
|
18
|
-
level,
|
|
19
18
|
toggleOpen,
|
|
20
19
|
}: {
|
|
21
20
|
schemas: SchemaObject[];
|
|
22
21
|
type: LogicalGroupType;
|
|
23
22
|
isOpen: boolean;
|
|
24
23
|
toggleOpen: () => void;
|
|
25
|
-
level: number;
|
|
26
24
|
}) => (
|
|
27
25
|
<Collapsible.Root open={isOpen} onOpenChange={toggleOpen} asChild>
|
|
28
26
|
<Card className="px-6">
|
|
@@ -34,12 +32,7 @@ export const LogicalGroup = ({
|
|
|
34
32
|
<Collapsible.Content className="pb-4">
|
|
35
33
|
{schemas.map((subSchema, index) => (
|
|
36
34
|
// eslint-disable-next-line react/no-array-index-key
|
|
37
|
-
<LogicalGroupItem
|
|
38
|
-
key={index}
|
|
39
|
-
type={type}
|
|
40
|
-
schema={subSchema}
|
|
41
|
-
level={level}
|
|
42
|
-
/>
|
|
35
|
+
<LogicalGroupItem key={index} type={type} schema={subSchema} />
|
|
43
36
|
))}
|
|
44
37
|
</Collapsible.Content>
|
|
45
38
|
</Card>
|
|
@@ -8,7 +8,6 @@ import { LogicalGroupConnector } from "./LogicalGroupConnector.js";
|
|
|
8
8
|
export const LogicalGroupItem = (props: {
|
|
9
9
|
type: LogicalGroupType;
|
|
10
10
|
schema: SchemaObject;
|
|
11
|
-
level: number;
|
|
12
11
|
}) => {
|
|
13
12
|
const [isOpen, setIsOpen] = useState(true);
|
|
14
13
|
|
|
@@ -23,7 +22,7 @@ export const LogicalGroupItem = (props: {
|
|
|
23
22
|
</Collapsible.Trigger>
|
|
24
23
|
{!isOpen && <div className="wavy-line bg-border translate-y-1" />}
|
|
25
24
|
<Collapsible.Content>
|
|
26
|
-
<SchemaView schema={props.schema}
|
|
25
|
+
<SchemaView schema={props.schema} />
|
|
27
26
|
</Collapsible.Content>
|
|
28
27
|
</Collapsible.Root>
|
|
29
28
|
);
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { SchemaObject } from "../../../oas/parser/index.js";
|
|
2
|
+
import { SelectOnClick } from "../components/SelectOnClick.js";
|
|
3
|
+
|
|
4
|
+
export const SchemaExampleAndDefault = ({
|
|
5
|
+
schema,
|
|
6
|
+
}: {
|
|
7
|
+
schema: SchemaObject;
|
|
8
|
+
}) => {
|
|
9
|
+
const example = schema.examples?.at(0);
|
|
10
|
+
const defaultValue = schema.default;
|
|
11
|
+
|
|
12
|
+
if (!example && !defaultValue) return null;
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className="flex flex-col gap-1 text-xs">
|
|
16
|
+
{example && (
|
|
17
|
+
<div>
|
|
18
|
+
<span className="text-muted-foreground">Example: </span>
|
|
19
|
+
<SelectOnClick className="border rounded px-1 font-mono">
|
|
20
|
+
{typeof example === "object" ? JSON.stringify(example) : example}
|
|
21
|
+
</SelectOnClick>
|
|
22
|
+
</div>
|
|
23
|
+
)}
|
|
24
|
+
{defaultValue && (
|
|
25
|
+
<div>
|
|
26
|
+
<span className="text-muted-foreground">Default: </span>
|
|
27
|
+
<SelectOnClick className="border rounded px-1 font-mono">
|
|
28
|
+
{typeof defaultValue === "object"
|
|
29
|
+
? JSON.stringify(defaultValue)
|
|
30
|
+
: defaultValue}
|
|
31
|
+
</SelectOnClick>
|
|
32
|
+
</div>
|
|
33
|
+
)}
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
};
|