zudoku 0.26.1 → 0.28.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.
Files changed (264) hide show
  1. package/dist/app/main.d.ts +1 -1
  2. package/dist/app/main.js +19 -7
  3. package/dist/app/main.js.map +1 -1
  4. package/dist/config/loader.js +1 -1
  5. package/dist/config/loader.js.map +1 -1
  6. package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
  7. package/dist/config/validators/common.d.ts +67 -0
  8. package/dist/config/validators/common.js +5 -0
  9. package/dist/config/validators/common.js.map +1 -1
  10. package/dist/config/validators/validate.d.ts +29 -0
  11. package/dist/lib/components/AnchorLink.js +5 -2
  12. package/dist/lib/components/AnchorLink.js.map +1 -1
  13. package/dist/lib/components/Header.js +1 -1
  14. package/dist/lib/components/Header.js.map +1 -1
  15. package/dist/lib/components/Heading.d.ts +1 -1
  16. package/dist/lib/components/Markdown.d.ts +2 -2
  17. package/dist/lib/components/Markdown.js +3 -1
  18. package/dist/lib/components/Markdown.js.map +1 -1
  19. package/dist/lib/components/StatusPage.d.ts +7 -0
  20. package/dist/lib/components/StatusPage.js +71 -0
  21. package/dist/lib/components/StatusPage.js.map +1 -0
  22. package/dist/lib/components/SyntaxHighlight.d.ts +2 -1
  23. package/dist/lib/components/SyntaxHighlight.js +2 -2
  24. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  25. package/dist/lib/components/ThemeSwitch.js +4 -4
  26. package/dist/lib/components/ThemeSwitch.js.map +1 -1
  27. package/dist/lib/components/cache.d.ts +6 -0
  28. package/dist/lib/components/cache.js +13 -0
  29. package/dist/lib/components/cache.js.map +1 -0
  30. package/dist/lib/components/context/ViewportAnchorContext.js +16 -4
  31. package/dist/lib/components/context/ViewportAnchorContext.js.map +1 -1
  32. package/dist/lib/components/context/ZudokuContext.js +2 -1
  33. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  34. package/dist/lib/components/index.d.ts +9 -2
  35. package/dist/lib/components/index.js +3 -0
  36. package/dist/lib/components/index.js.map +1 -1
  37. package/dist/lib/components/navigation/SidebarCategory.js +3 -3
  38. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  39. package/dist/lib/core/RouteGuard.d.ts +1 -0
  40. package/dist/lib/core/RouteGuard.js +28 -0
  41. package/dist/lib/core/RouteGuard.js.map +1 -0
  42. package/dist/lib/core/ZudokuContext.d.ts +4 -2
  43. package/dist/lib/core/ZudokuContext.js +9 -7
  44. package/dist/lib/core/ZudokuContext.js.map +1 -1
  45. package/dist/lib/oas/graphql/circular.d.ts +3 -0
  46. package/dist/lib/oas/graphql/circular.js +27 -0
  47. package/dist/lib/oas/graphql/circular.js.map +1 -0
  48. package/dist/lib/oas/graphql/index.d.ts +1 -0
  49. package/dist/lib/oas/graphql/index.js +46 -29
  50. package/dist/lib/oas/graphql/index.js.map +1 -1
  51. package/dist/lib/oas/parser/dereference/index.d.ts +0 -1
  52. package/dist/lib/oas/parser/dereference/index.js +1 -1
  53. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  54. package/dist/lib/plugins/openapi/Endpoint.js +2 -2
  55. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  56. package/dist/lib/plugins/openapi/{Route.d.ts → OpenApiRoute.d.ts} +2 -1
  57. package/dist/lib/plugins/openapi/{Route.js → OpenApiRoute.js} +3 -4
  58. package/dist/lib/plugins/openapi/OpenApiRoute.js.map +1 -0
  59. package/dist/lib/plugins/openapi/OperationList.d.ts +4 -1
  60. package/dist/lib/plugins/openapi/OperationList.js +20 -14
  61. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  62. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  63. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  64. package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
  65. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  66. package/dist/lib/plugins/openapi/RequestBodySidecarBox.d.ts +1 -1
  67. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +2 -0
  68. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  69. package/dist/lib/plugins/openapi/Sidecar.js +3 -3
  70. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  71. package/dist/lib/plugins/openapi/SidecarExamples.js +17 -14
  72. package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
  73. package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -2
  74. package/dist/lib/plugins/openapi/graphql/gql.js +3 -2
  75. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  76. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +47 -26
  77. package/dist/lib/plugins/openapi/graphql/graphql.js +20 -16
  78. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  79. package/dist/lib/plugins/openapi/index.js +101 -65
  80. package/dist/lib/plugins/openapi/index.js.map +1 -1
  81. package/dist/lib/plugins/openapi/interfaces.d.ts +8 -2
  82. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js +5 -5
  83. package/dist/lib/plugins/openapi/playground/ExamplesDropdown.js.map +1 -1
  84. package/dist/lib/plugins/openapi/playground/Headers.js +17 -16
  85. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
  86. package/dist/lib/plugins/openapi/playground/ParamsGrid.d.ts +5 -0
  87. package/dist/lib/plugins/openapi/playground/ParamsGrid.js +4 -0
  88. package/dist/lib/plugins/openapi/playground/ParamsGrid.js.map +1 -0
  89. package/dist/lib/plugins/openapi/playground/PathParams.js +4 -12
  90. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  91. package/dist/lib/plugins/openapi/playground/Playground.d.ts +13 -0
  92. package/dist/lib/plugins/openapi/playground/Playground.js +19 -31
  93. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  94. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
  95. package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -1
  96. package/dist/lib/plugins/openapi/playground/QueryParams.js +4 -3
  97. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
  98. package/dist/lib/plugins/openapi/playground/SubmitButton.d.ts +7 -0
  99. package/dist/lib/plugins/openapi/playground/SubmitButton.js +22 -0
  100. package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -0
  101. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.d.ts +7 -0
  102. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js +11 -0
  103. package/dist/lib/plugins/openapi/playground/result-panel/RequestTab.js.map +1 -0
  104. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.d.ts +8 -0
  105. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +95 -0
  106. package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -0
  107. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.d.ts +7 -0
  108. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js +16 -0
  109. package/dist/lib/plugins/openapi/playground/result-panel/ResultPanel.js.map +1 -0
  110. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.d.ts +10 -0
  111. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js +32 -0
  112. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.js.map +1 -0
  113. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.d.ts +1 -0
  114. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js +56 -0
  115. package/dist/lib/plugins/openapi/playground/result-panel/convertToTypes.test.js.map +1 -0
  116. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +1 -1
  117. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  118. package/dist/lib/ui/Command.js +1 -1
  119. package/dist/lib/ui/Command.js.map +1 -1
  120. package/dist/lib/ui/Select.js +2 -2
  121. package/dist/lib/ui/Select.js.map +1 -1
  122. package/dist/lib/util/MdxComponents.js +2 -2
  123. package/dist/lib/util/MdxComponents.js.map +1 -1
  124. package/dist/lib/util/joinUrl.js +1 -1
  125. package/dist/lib/util/joinUrl.js.map +1 -1
  126. package/dist/lib/util/joinUrl.test.d.ts +1 -0
  127. package/dist/lib/util/joinUrl.test.js +43 -0
  128. package/dist/lib/util/joinUrl.test.js.map +1 -0
  129. package/dist/lib/util/useScrollToAnchor.d.ts +1 -0
  130. package/dist/lib/util/useScrollToAnchor.js +26 -15
  131. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  132. package/dist/vite/plugin-api.js +15 -3
  133. package/dist/vite/plugin-api.js.map +1 -1
  134. package/dist/vite/prerender.js +1 -0
  135. package/dist/vite/prerender.js.map +1 -1
  136. package/dist/zuplo/enrich-with-zuplo.js +1 -1
  137. package/dist/zuplo/enrich-with-zuplo.js.map +1 -1
  138. package/dist/zuplo/with-zuplo.d.ts +2 -1
  139. package/dist/zuplo/with-zuplo.js +3 -1
  140. package/dist/zuplo/with-zuplo.js.map +1 -1
  141. package/lib/{AuthenticationPlugin-C9SwOxkc.js → AuthenticationPlugin-Du8cLBSr.js} +3 -3
  142. package/lib/{AuthenticationPlugin-C9SwOxkc.js.map → AuthenticationPlugin-Du8cLBSr.js.map} +1 -1
  143. package/lib/{Markdown-DFN6p0J-.js → Markdown-Cyrx_JrO.js} +1195 -1185
  144. package/lib/{Markdown-DFN6p0J-.js.map → Markdown-Cyrx_JrO.js.map} +1 -1
  145. package/lib/{MdxPage-D9c4z09Q.js → MdxPage-DewragjB.js} +6 -6
  146. package/lib/{MdxPage-D9c4z09Q.js.map → MdxPage-DewragjB.js.map} +1 -1
  147. package/lib/OpenApiRoute-UrC_t0e5.js +36 -0
  148. package/lib/OpenApiRoute-UrC_t0e5.js.map +1 -0
  149. package/lib/{OperationList-DGJWDx1G.js → OperationList-D_ejrepA.js} +1970 -1957
  150. package/lib/OperationList-D_ejrepA.js.map +1 -0
  151. package/lib/{Select-D3O7wISy.js → Select-CnCZ4WhS.js} +61 -61
  152. package/lib/Select-CnCZ4WhS.js.map +1 -0
  153. package/lib/{SlotletProvider-_3zzX_g_.js → SlotletProvider-mQiPDQIH.js} +4 -4
  154. package/lib/{SlotletProvider-_3zzX_g_.js.map → SlotletProvider-mQiPDQIH.js.map} +1 -1
  155. package/lib/{SyntaxHighlight-CJCSPG1F.js → SyntaxHighlight-B0L4SC_N.js} +309 -298
  156. package/lib/SyntaxHighlight-B0L4SC_N.js.map +1 -0
  157. package/lib/{ZudokuContext-DeQZEp-x.js → ZudokuContext-BTUJPpQl.js} +257 -246
  158. package/lib/ZudokuContext-BTUJPpQl.js.map +1 -0
  159. package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js → chunk-SYFQ2XB5-BPvC-soB.js} +5 -5
  160. package/lib/{chunk-SYFQ2XB5-BF5IDYrB.js.map → chunk-SYFQ2XB5-BPvC-soB.js.map} +1 -1
  161. package/lib/circular-Dgpd6AN-.js +15397 -0
  162. package/lib/circular-Dgpd6AN-.js.map +1 -0
  163. package/lib/{createServer-BcaswoFO.js → createServer-BydbkTsd.js} +3487 -5601
  164. package/lib/createServer-BydbkTsd.js.map +1 -0
  165. package/lib/{hook-BRQEDRbn.js → hook-FT3SJLe_.js} +2 -2
  166. package/lib/{hook-BRQEDRbn.js.map → hook-FT3SJLe_.js.map} +1 -1
  167. package/lib/{index-LNp6rxyU.js → index-CjJS0l4l.js} +2 -2
  168. package/lib/{index-LNp6rxyU.js.map → index-CjJS0l4l.js.map} +1 -1
  169. package/lib/index-DGugJOLc.js +1974 -0
  170. package/lib/index-DGugJOLc.js.map +1 -0
  171. package/lib/{joinUrl-BTy9bvoK.js → joinUrl-nLx9pD-Z.js} +2 -2
  172. package/lib/joinUrl-nLx9pD-Z.js.map +1 -0
  173. package/lib/ui/Command.js +27 -27
  174. package/lib/ui/Command.js.map +1 -1
  175. package/lib/ui/Select.js +2 -2
  176. package/lib/ui/Select.js.map +1 -1
  177. package/lib/{useExposedProps-CetwhZpP.js → useExposedProps-BLKFBylA.js} +2 -2
  178. package/lib/{useExposedProps-CetwhZpP.js.map → useExposedProps-BLKFBylA.js.map} +1 -1
  179. package/lib/useScrollToAnchor-eRM9tVvD.js +289 -0
  180. package/lib/useScrollToAnchor-eRM9tVvD.js.map +1 -0
  181. package/lib/zudoku.auth-clerk.js +1 -1
  182. package/lib/zudoku.auth-openid.js +4 -4
  183. package/lib/zudoku.components.js +740 -979
  184. package/lib/zudoku.components.js.map +1 -1
  185. package/lib/zudoku.plugin-api-catalog.js +4 -4
  186. package/lib/zudoku.plugin-api-keys.js +5 -5
  187. package/lib/zudoku.plugin-custom-pages.js +2 -2
  188. package/lib/zudoku.plugin-markdown.js +1 -1
  189. package/lib/zudoku.plugin-openapi.js +6 -5
  190. package/lib/zudoku.plugin-openapi.js.map +1 -1
  191. package/lib/zudoku.plugin-redirect.js +1 -1
  192. package/package.json +2 -2
  193. package/src/app/main.tsx +26 -7
  194. package/src/lib/components/AnchorLink.tsx +5 -2
  195. package/src/lib/components/Header.tsx +1 -1
  196. package/src/lib/components/Markdown.tsx +14 -15
  197. package/src/lib/components/StatusPage.tsx +91 -0
  198. package/src/lib/components/SyntaxHighlight.tsx +14 -0
  199. package/src/lib/components/ThemeSwitch.tsx +14 -15
  200. package/src/lib/components/cache.ts +15 -0
  201. package/src/lib/components/context/ViewportAnchorContext.tsx +20 -6
  202. package/src/lib/components/context/ZudokuContext.ts +3 -1
  203. package/src/lib/components/index.ts +7 -0
  204. package/src/lib/components/navigation/SidebarCategory.tsx +3 -2
  205. package/src/lib/core/RouteGuard.tsx +35 -0
  206. package/src/lib/core/ZudokuContext.ts +9 -8
  207. package/src/lib/oas/graphql/circular.ts +29 -0
  208. package/src/lib/oas/graphql/index.ts +72 -44
  209. package/src/lib/oas/parser/dereference/index.ts +1 -2
  210. package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
  211. package/src/lib/plugins/openapi/{Route.tsx → OpenApiRoute.tsx} +3 -3
  212. package/src/lib/plugins/openapi/OperationList.tsx +34 -12
  213. package/src/lib/plugins/openapi/OperationListItem.tsx +0 -2
  214. package/src/lib/plugins/openapi/ParameterListItem.tsx +1 -0
  215. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -0
  216. package/src/lib/plugins/openapi/Sidecar.tsx +4 -3
  217. package/src/lib/plugins/openapi/SidecarExamples.tsx +24 -24
  218. package/src/lib/plugins/openapi/graphql/gql.ts +12 -4
  219. package/src/lib/plugins/openapi/graphql/graphql.ts +66 -43
  220. package/src/lib/plugins/openapi/index.tsx +134 -82
  221. package/src/lib/plugins/openapi/interfaces.ts +11 -2
  222. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +30 -27
  223. package/src/lib/plugins/openapi/playground/Headers.tsx +65 -65
  224. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +8 -0
  225. package/src/lib/plugins/openapi/playground/PathParams.tsx +34 -74
  226. package/src/lib/plugins/openapi/playground/Playground.tsx +64 -116
  227. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
  228. package/src/lib/plugins/openapi/playground/QueryParams.tsx +46 -45
  229. package/src/lib/plugins/openapi/playground/SubmitButton.tsx +75 -0
  230. package/src/lib/plugins/openapi/playground/result-panel/RequestTab.tsx +73 -0
  231. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +210 -0
  232. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +101 -0
  233. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.test.ts +64 -0
  234. package/src/lib/plugins/openapi/playground/result-panel/convertToTypes.ts +36 -0
  235. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +1 -1
  236. package/src/lib/ui/Command.tsx +1 -1
  237. package/src/lib/ui/Select.tsx +1 -1
  238. package/src/lib/util/MdxComponents.tsx +2 -1
  239. package/src/lib/util/joinUrl.test.ts +62 -0
  240. package/src/lib/util/joinUrl.ts +1 -1
  241. package/src/lib/util/useScrollToAnchor.ts +32 -15
  242. package/dist/lib/plugins/openapi/Route.js.map +0 -1
  243. package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +0 -4
  244. package/dist/lib/plugins/openapi/playground/ResponseTab.js +0 -42
  245. package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +0 -1
  246. package/lib/AnchorLink-bObQitZv.js +0 -34
  247. package/lib/AnchorLink-bObQitZv.js.map +0 -1
  248. package/lib/OperationList-DGJWDx1G.js.map +0 -1
  249. package/lib/Route-VdmEyOD0.js +0 -35
  250. package/lib/Route-VdmEyOD0.js.map +0 -1
  251. package/lib/Select-D3O7wISy.js.map +0 -1
  252. package/lib/StaggeredRender-DgsamH_G.js +0 -17
  253. package/lib/StaggeredRender-DgsamH_G.js.map +0 -1
  254. package/lib/SyntaxHighlight-CJCSPG1F.js.map +0 -1
  255. package/lib/ZudokuContext-DeQZEp-x.js.map +0 -1
  256. package/lib/createServer-BcaswoFO.js.map +0 -1
  257. package/lib/index-Bn6Lc9tq.js +0 -9
  258. package/lib/index-Bn6Lc9tq.js.map +0 -1
  259. package/lib/index-CXRrqOIl.js +0 -1750
  260. package/lib/index-CXRrqOIl.js.map +0 -1
  261. package/lib/index-TaRXY2w1.js +0 -43
  262. package/lib/index-TaRXY2w1.js.map +0 -1
  263. package/lib/joinUrl-BTy9bvoK.js.map +0 -1
  264. package/src/lib/plugins/openapi/playground/ResponseTab.tsx +0 -76
@@ -31,6 +31,8 @@ export type Scalars = {
31
31
  JSON: { input: any; output: any };
32
32
  /** The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). */
33
33
  JSONObject: { input: any; output: any };
34
+ /** OpenAPI schema scalar type that handles circular references */
35
+ JSONSchema: { input: any; output: any };
34
36
  };
35
37
 
36
38
  export type EncodingItem = {
@@ -57,7 +59,7 @@ export type MediaTypeObject = {
57
59
  encoding?: Maybe<Array<EncodingItem>>;
58
60
  examples?: Maybe<Array<ExampleItem>>;
59
61
  mediaType: Scalars["String"]["output"];
60
- schema?: Maybe<Scalars["JSON"]["output"]>;
62
+ schema?: Maybe<Scalars["JSONSchema"]["output"]>;
61
63
  };
62
64
 
63
65
  export type OperationItem = {
@@ -89,7 +91,7 @@ export type ParameterItem = {
89
91
  in: ParameterIn;
90
92
  name: Scalars["String"]["output"];
91
93
  required?: Maybe<Scalars["Boolean"]["output"]>;
92
- schema?: Maybe<Scalars["JSON"]["output"]>;
94
+ schema?: Maybe<Scalars["JSONSchema"]["output"]>;
93
95
  style?: Maybe<Scalars["String"]["output"]>;
94
96
  };
95
97
 
@@ -132,11 +134,11 @@ export type Schema = {
132
134
  operations: Array<OperationItem>;
133
135
  paths: Array<PathItem>;
134
136
  servers: Array<Server>;
137
+ summary?: Maybe<Scalars["String"]["output"]>;
135
138
  tags: Array<SchemaTag>;
136
139
  title: Scalars["String"]["output"];
137
- url: Scalars["String"]["output"];
140
+ url?: Maybe<Scalars["String"]["output"]>;
138
141
  version: Scalars["String"]["output"];
139
- summary?: Maybe<Scalars["String"]["output"]>;
140
142
  };
141
143
 
142
144
  export type SchemaOperationsArgs = {
@@ -144,6 +146,7 @@ export type SchemaOperationsArgs = {
144
146
  operationId?: InputMaybe<Scalars["String"]["input"]>;
145
147
  path?: InputMaybe<Scalars["String"]["input"]>;
146
148
  tag?: InputMaybe<Scalars["String"]["input"]>;
149
+ untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
147
150
  };
148
151
 
149
152
  export type SchemaTagsArgs = {
@@ -180,7 +183,7 @@ export type ServersQueryQuery = {
180
183
  __typename?: "Query";
181
184
  schema: {
182
185
  __typename?: "Schema";
183
- url: string;
186
+ url?: string | null;
184
187
  servers: Array<{ __typename?: "Server"; url: string }>;
185
188
  };
186
189
  };
@@ -255,6 +258,8 @@ export type OperationsFragmentFragment = {
255
258
  export type AllOperationsQueryVariables = Exact<{
256
259
  input: Scalars["JSON"]["input"];
257
260
  type: SchemaType;
261
+ tag?: InputMaybe<Scalars["String"]["input"]>;
262
+ untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
258
263
  }>;
259
264
 
260
265
  export type AllOperationsQuery = {
@@ -264,20 +269,20 @@ export type AllOperationsQuery = {
264
269
  description?: string | null;
265
270
  summary?: string | null;
266
271
  title: string;
267
- url: string;
272
+ url?: string | null;
268
273
  version: string;
269
274
  tags: Array<{
270
275
  __typename?: "SchemaTag";
271
276
  name?: string | null;
272
277
  description?: string | null;
273
- operations: Array<
274
- { __typename?: "OperationItem"; slug: string } & {
275
- " $fragmentRefs"?: {
276
- OperationsFragmentFragment: OperationsFragmentFragment;
277
- };
278
- }
279
- >;
280
278
  }>;
279
+ operations: Array<
280
+ { __typename?: "OperationItem"; slug: string } & {
281
+ " $fragmentRefs"?: {
282
+ OperationsFragmentFragment: OperationsFragmentFragment;
283
+ };
284
+ }
285
+ >;
281
286
  };
282
287
  };
283
288
 
@@ -290,7 +295,7 @@ export type GetServerQueryQuery = {
290
295
  __typename?: "Query";
291
296
  schema: {
292
297
  __typename?: "Schema";
293
- url: string;
298
+ url?: string | null;
294
299
  servers: Array<{ __typename?: "Server"; url: string }>;
295
300
  };
296
301
  };
@@ -304,19 +309,30 @@ export type GetCategoriesQuery = {
304
309
  __typename?: "Query";
305
310
  schema: {
306
311
  __typename?: "Schema";
307
- url: string;
308
- tags: Array<{
309
- __typename: "SchemaTag";
310
- name?: string | null;
311
- operations: Array<{
312
- __typename: "OperationItem";
313
- slug: string;
314
- deprecated?: boolean | null;
315
- method: string;
316
- summary?: string | null;
317
- operationId?: string | null;
318
- path: string;
319
- }>;
312
+ url?: string | null;
313
+ tags: Array<{ __typename?: "SchemaTag"; name?: string | null }>;
314
+ };
315
+ };
316
+
317
+ export type GetOperationsQueryVariables = Exact<{
318
+ input: Scalars["JSON"]["input"];
319
+ type: SchemaType;
320
+ tag?: InputMaybe<Scalars["String"]["input"]>;
321
+ untagged?: InputMaybe<Scalars["Boolean"]["input"]>;
322
+ }>;
323
+
324
+ export type GetOperationsQuery = {
325
+ __typename?: "Query";
326
+ schema: {
327
+ __typename?: "Schema";
328
+ operations: Array<{
329
+ __typename?: "OperationItem";
330
+ slug: string;
331
+ deprecated?: boolean | null;
332
+ method: string;
333
+ summary?: string | null;
334
+ operationId?: string | null;
335
+ path: string;
320
336
  }>;
321
337
  };
322
338
  };
@@ -418,20 +434,20 @@ export const ServersQueryDocument = new TypedDocumentString(`
418
434
  ServersQueryQueryVariables
419
435
  >;
420
436
  export const AllOperationsDocument = new TypedDocumentString(`
421
- query AllOperations($input: JSON!, $type: SchemaType!) {
437
+ query AllOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
422
438
  schema(input: $input, type: $type) {
423
439
  description
424
440
  summary
425
441
  title
426
442
  url
427
443
  version
428
- tags {
444
+ tags(name: $tag) {
429
445
  name
430
446
  description
431
- operations {
432
- slug
433
- ...OperationsFragment
434
- }
447
+ }
448
+ operations(tag: $tag, untagged: $untagged) {
449
+ slug
450
+ ...OperationsFragment
435
451
  }
436
452
  }
437
453
  }
@@ -517,17 +533,7 @@ export const GetCategoriesDocument = new TypedDocumentString(`
517
533
  schema(input: $input, type: $type) {
518
534
  url
519
535
  tags {
520
- __typename
521
536
  name
522
- operations {
523
- __typename
524
- slug
525
- deprecated
526
- method
527
- summary
528
- operationId
529
- path
530
- }
531
537
  }
532
538
  }
533
539
  }
@@ -535,3 +541,20 @@ export const GetCategoriesDocument = new TypedDocumentString(`
535
541
  GetCategoriesQuery,
536
542
  GetCategoriesQueryVariables
537
543
  >;
544
+ export const GetOperationsDocument = new TypedDocumentString(`
545
+ query GetOperations($input: JSON!, $type: SchemaType!, $tag: String, $untagged: Boolean) {
546
+ schema(input: $input, type: $type) {
547
+ operations(tag: $tag, untagged: $untagged) {
548
+ slug
549
+ deprecated
550
+ method
551
+ summary
552
+ operationId
553
+ path
554
+ }
555
+ }
556
+ }
557
+ `) as unknown as TypedDocumentString<
558
+ GetOperationsQuery,
559
+ GetOperationsQueryVariables
560
+ >;
@@ -1,16 +1,15 @@
1
- import { matchPath } from "react-router";
2
- import { type ZudokuPlugin } from "../../core/plugins.js";
3
- import { graphql } from "./graphql/index.js";
4
-
5
- import { useQuery } from "@tanstack/react-query";
1
+ import slugify from "@sindresorhus/slugify";
6
2
  import { CirclePlayIcon, LogInIcon } from "lucide-react";
3
+ import { matchPath, redirect, RouteObject } from "react-router";
7
4
  import type { SidebarItem } from "../../../config/validators/SidebarSchema.js";
8
5
  import { useAuth } from "../../authentication/hook.js";
9
6
  import { ColorMap } from "../../components/navigation/SidebarBadge.js";
7
+ import { type ZudokuPlugin } from "../../core/plugins.js";
10
8
  import type { SchemaImports } from "../../oas/graphql/index.js";
11
9
  import { Button } from "../../ui/Button.js";
12
- import { joinPath } from "../../util/joinPath.js";
10
+ import { joinUrl } from "../../util/joinUrl.js";
13
11
  import { GraphQLClient } from "./client/GraphQLClient.js";
12
+ import { graphql } from "./graphql/index.js";
14
13
  import { OasPluginConfig } from "./interfaces.js";
15
14
  import type { PlaygroundContentProps } from "./playground/Playground.js";
16
15
  import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
@@ -20,17 +19,27 @@ const GetCategoriesQuery = graphql(`
20
19
  schema(input: $input, type: $type) {
21
20
  url
22
21
  tags {
23
- __typename
24
22
  name
25
- operations {
26
- __typename
27
- slug
28
- deprecated
29
- method
30
- summary
31
- operationId
32
- path
33
- }
23
+ }
24
+ }
25
+ }
26
+ `);
27
+
28
+ const GetOperationsQuery = graphql(`
29
+ query GetOperations(
30
+ $input: JSON!
31
+ $type: SchemaType!
32
+ $tag: String
33
+ $untagged: Boolean
34
+ ) {
35
+ schema(input: $input, type: $type) {
36
+ operations(tag: $tag, untagged: $untagged) {
37
+ slug
38
+ deprecated
39
+ method
40
+ summary
41
+ operationId
42
+ path
34
43
  }
35
44
  }
36
45
  }
@@ -50,9 +59,10 @@ const MethodColorMap: Record<string, keyof typeof ColorMap> = {
50
59
 
51
60
  export type OpenApiPluginOptions = OasPluginConfig & InternalOasPluginConfig;
52
61
 
53
- export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
54
- const basePath = joinPath(config.navigationId ?? "/reference");
62
+ const UNTAGGED_PATH = "~endpoints";
55
63
 
64
+ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
65
+ const basePath = joinUrl(config.navigationId ?? "/reference");
56
66
  const versions = config.type === "file" ? Object.keys(config.input) : [];
57
67
 
58
68
  const client = new GraphQLClient(config);
@@ -81,18 +91,15 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
81
91
  method,
82
92
  url,
83
93
  ...props
84
- }: Partial<PlaygroundContentProps> & { requireAuth: boolean }) => {
94
+ }: Partial<PlaygroundContentProps> &
95
+ Pick<PlaygroundContentProps, "server"> & {
96
+ requireAuth: boolean;
97
+ }) => {
85
98
  const auth = useAuth();
86
- // We don't have the GraphQL context here
87
- const serverQuery = useQuery({
88
- queryFn: () =>
89
- client.fetch(GetCategoriesQuery, {
90
- type: config.type,
91
- input: config.input,
92
- }),
93
- enabled: !server,
94
- queryKey: ["playground-server"],
95
- });
99
+
100
+ if (!server) {
101
+ throw new Error("Server is required");
102
+ }
96
103
 
97
104
  if (requireAuth && !auth.isAuthenticated) {
98
105
  return (
@@ -110,9 +117,7 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
110
117
  <PlaygroundDialog
111
118
  url={url ?? "/"}
112
119
  method={method ?? "get"}
113
- server={
114
- server ?? serverQuery.data?.schema.url ?? "https://example.com"
115
- }
120
+ server={server}
116
121
  {...props}
117
122
  >
118
123
  <Button className="gap-2 items-center" variant="outline">
@@ -128,41 +133,60 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
128
133
  }
129
134
 
130
135
  try {
131
- const version =
132
- versions.find((v) => path === joinPath(basePath, v)) ??
133
- Object.keys(config.input).at(0);
136
+ const urlVersion = versions.find((v) =>
137
+ path.startsWith(joinUrl(basePath, v)),
138
+ );
139
+ const version = urlVersion ?? Object.keys(config.input).at(0);
134
140
 
135
141
  const data = await client.fetch(GetCategoriesQuery, {
136
142
  type: config.type,
137
143
  input: config.type === "file" ? config.input[version!] : config.input,
138
- version,
139
144
  });
140
145
 
141
- const categories = data.schema.tags
142
- .filter((tag) => tag.operations.length > 0)
143
- .map<SidebarItem>((tag) => ({
144
- type: "category",
145
- label: tag.name || "Other endpoints",
146
- collapsible: true,
147
- collapsed: false,
148
- items: tag.operations.map((operation) => ({
149
- type: "link",
150
- label: operation.summary ?? operation.path,
151
- href: `#${operation.slug}`,
152
- badge: {
153
- label: operation.method,
154
- color: MethodColorMap[operation.method.toLowerCase()]!,
155
- invert: true,
156
- },
157
- })),
158
- }));
146
+ const tag = config.tagPages?.find(
147
+ (tag) => path.split("/").at(-1) === slugify(tag),
148
+ );
159
149
 
160
- categories.unshift({
161
- type: "link",
162
- label: "Overview",
163
- href: "#description",
150
+ const operationsData = await client.fetch(GetOperationsQuery, {
151
+ type: config.type,
152
+ input: config.type === "file" ? config.input[version!] : config.input,
153
+ tag,
154
+ untagged: tag === undefined,
164
155
  });
165
156
 
157
+ const items = operationsData.schema.operations.map((operation) => ({
158
+ type: "link" as const,
159
+ label: operation.summary ?? operation.path,
160
+ href: `#${operation.slug}`,
161
+ badge: {
162
+ label: operation.method,
163
+ color: MethodColorMap[operation.method.toLowerCase()]!,
164
+ invert: true,
165
+ } as const,
166
+ }));
167
+
168
+ const categories = data.schema.tags
169
+ // .filter((tag) => tag.operations.length > 0)
170
+ .map<SidebarItem>((tag) => {
171
+ const categoryLink = joinUrl(
172
+ basePath,
173
+ urlVersion,
174
+ tag.name ? slugify(tag.name) : UNTAGGED_PATH,
175
+ );
176
+ return {
177
+ type: "category",
178
+ label: tag.name || "Other endpoints",
179
+ link: {
180
+ type: "doc" as const,
181
+ id: categoryLink,
182
+ label: tag.name!,
183
+ },
184
+ collapsible: false,
185
+ collapsed: true,
186
+ items: path === categoryLink ? items : [],
187
+ };
188
+ });
189
+
166
190
  return categories;
167
191
  } catch {
168
192
  return [];
@@ -171,31 +195,59 @@ export const openApiPlugin = (config: OpenApiPluginOptions): ZudokuPlugin => {
171
195
  getRoutes: () => {
172
196
  const versionsInPath = [null, ...versions];
173
197
 
174
- return versionsInPath.map((version) => ({
175
- path: basePath + (version ? `/${version}` : ""),
176
- async lazy() {
177
- const { OpenApiRoute } = await import("./Route.js");
178
- return {
179
- element: (
180
- <OpenApiRoute
181
- basePath={basePath}
182
- versions={versions}
183
- client={client}
184
- config={config}
185
- />
186
- ),
187
- };
188
- },
189
- children: [
190
- {
191
- index: true,
192
- async lazy() {
193
- const { OperationList } = await import("./OperationList.js");
194
- return { element: <OperationList /> };
195
- },
196
- },
197
- ],
198
+ const tagPages = (config.tagPages ?? []).map((tag) => ({
199
+ tag,
200
+ path: slugify(tag),
198
201
  }));
202
+
203
+ return versionsInPath.map((version) => {
204
+ const versionPath = joinUrl(basePath, version ? `/${version}` : "");
205
+
206
+ return {
207
+ path: versionPath,
208
+ async lazy() {
209
+ const { OpenApiRoute } = await import("./OpenApiRoute.js");
210
+ return {
211
+ element: (
212
+ <OpenApiRoute
213
+ version={version ?? undefined}
214
+ basePath={basePath}
215
+ versions={versions}
216
+ client={client}
217
+ config={config}
218
+ />
219
+ ),
220
+ };
221
+ },
222
+ children: [
223
+ {
224
+ index: true,
225
+ loader: () =>
226
+ redirect(
227
+ joinUrl(versionPath, tagPages.at(0)?.path ?? UNTAGGED_PATH),
228
+ ),
229
+ },
230
+ {
231
+ path: joinUrl(versionPath, UNTAGGED_PATH),
232
+ async lazy() {
233
+ const { OperationList } = await import("./OperationList.js");
234
+ return { element: <OperationList untagged={true} /> };
235
+ },
236
+ },
237
+ ...tagPages.map<RouteObject>((tag) => {
238
+ return {
239
+ path: joinUrl(versionPath, tag.path),
240
+ async lazy() {
241
+ const { OperationList } = await import("./OperationList.js");
242
+ return {
243
+ element: <OperationList tag={tag.tag} />,
244
+ };
245
+ },
246
+ };
247
+ }),
248
+ ],
249
+ };
250
+ });
199
251
  },
200
252
  };
201
253
  };
@@ -20,7 +20,15 @@ export type OasPluginConfig = {
20
20
  server?: string;
21
21
  navigationId?: string;
22
22
  skipPreload?: boolean;
23
- } & OasSource;
23
+ tagPages?: Array<string>;
24
+ } & OasPluginConfigOptions &
25
+ OasSource;
26
+
27
+ export type OasPluginConfigOptions = {
28
+ options?: {
29
+ examplesDefaultLanguage?: string;
30
+ };
31
+ };
24
32
 
25
33
  export type OasPluginContext = {
26
34
  server?: string;
@@ -28,4 +36,5 @@ export type OasPluginContext = {
28
36
  skipPreload?: boolean;
29
37
  version?: string;
30
38
  versions: Record<string, string>;
31
- } & ContextOasSource;
39
+ } & ContextOasSource &
40
+ OasPluginConfigOptions;
@@ -18,33 +18,36 @@ const ExamplesDropdown = ({
18
18
  onSelect: (example: Example) => void;
19
19
  }) => {
20
20
  return (
21
- <DropdownMenu>
22
- <DropdownMenuTrigger asChild>
23
- <Button variant="outline">Use Example</Button>
24
- </DropdownMenuTrigger>
25
- <DropdownMenuContent className="w-56">
26
- {examples.map((example) => {
27
- return (
28
- <div key={example.mediaType}>
29
- <DropdownMenuLabel>{example.mediaType}</DropdownMenuLabel>
30
- <DropdownMenuSeparator />
31
- <DropdownMenuGroup>
32
- {example.examples?.map((example) => {
33
- return (
34
- <DropdownMenuItem
35
- key={example.name}
36
- onSelect={() => onSelect(example)}
37
- >
38
- {example.name}
39
- </DropdownMenuItem>
40
- );
41
- })}
42
- </DropdownMenuGroup>
43
- </div>
44
- );
45
- })}
46
- </DropdownMenuContent>
47
- </DropdownMenu>
21
+ <div className="flex flex-col gap-2 mt-2 items-end">
22
+ <DropdownMenu>
23
+ <DropdownMenuTrigger asChild>
24
+ <Button variant="outline">Use Example</Button>
25
+ </DropdownMenuTrigger>
26
+ <DropdownMenuContent className="w-56">
27
+ {examples.map((example) => {
28
+ return (
29
+ <div key={example.mediaType}>
30
+ <DropdownMenuLabel>{example.mediaType}</DropdownMenuLabel>
31
+ <DropdownMenuSeparator />
32
+ <DropdownMenuGroup>
33
+ {example.examples?.map((example) => {
34
+ return (
35
+ <DropdownMenuItem
36
+ key={example.name}
37
+ onSelect={() => onSelect(example)}
38
+ className="line-clamp-1"
39
+ >
40
+ {example.summary ?? example.name}
41
+ </DropdownMenuItem>
42
+ );
43
+ })}
44
+ </DropdownMenuGroup>
45
+ </div>
46
+ );
47
+ })}
48
+ </DropdownMenuContent>
49
+ </DropdownMenu>
50
+ </div>
48
51
  );
49
52
  };
50
53