@lukoweb/apitogo 0.2.54 → 0.2.57

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 (82) hide show
  1. package/dist/cli/cli.js +2196 -1352
  2. package/dist/declarations/cli/platform/client/platform-api.d.ts +29 -0
  3. package/dist/declarations/cli/platform/helpers/platform-plan-catalog.d.ts +6 -0
  4. package/dist/declarations/config/validators/ZudokuConfig.d.ts +2 -0
  5. package/dist/declarations/lib/authentication/providers/openid.d.ts +2 -1
  6. package/dist/declarations/lib/plugins/markdown/index.d.ts +2 -1
  7. package/dist/flat-config.d.ts +1 -0
  8. package/docs/cli/commands.md +50 -32
  9. package/docs/cli/go-live.md +66 -93
  10. package/docs/cli/overview.md +18 -17
  11. package/docs/cli/setup.md +130 -141
  12. package/docs/cli/shape.md +94 -11
  13. package/docs/cli/walkthrough.md +1 -1
  14. package/docs/components/slot.mdx +116 -119
  15. package/docs/configuration/api-reference.md +98 -397
  16. package/docs/configuration/authentication.md +118 -159
  17. package/docs/configuration/footer.mdx +89 -118
  18. package/docs/configuration/make-config.mdx +2 -2
  19. package/docs/configuration/overview.md +97 -166
  20. package/docs/configuration/plans.md +100 -110
  21. package/docs/configuration/portal.md +116 -0
  22. package/docs/customization/colors-theme.mdx +255 -278
  23. package/docs/customization/fonts.md +105 -110
  24. package/docs/customization/landing-page.md +189 -188
  25. package/docs/deploy/apitogo.md +13 -17
  26. package/docs/deployment.md +15 -9
  27. package/docs/guides/stripe-setup.mdx +123 -0
  28. package/docs/markdown/frontmatter.md +172 -173
  29. package/docs/mcp/go-live.md +100 -100
  30. package/docs/mcp/overview.md +76 -76
  31. package/docs/quickstart.md +88 -72
  32. package/docs/writing.mdx +68 -72
  33. package/package.json +1 -1
  34. package/src/config/v2/docs-navigation.ts +7 -2
  35. package/src/config/v2/index.ts +1 -0
  36. package/src/config/v2/resolve.ts +28 -0
  37. package/src/config/v2/rules.ts +32 -1
  38. package/src/config/v2/schema.ts +9 -0
  39. package/src/config/v2/services.ts +90 -15
  40. package/src/config/v2/starter-landing.ts +41 -0
  41. package/src/config/v2/wrapper.ts +141 -7
  42. package/src/config/validators/ZudokuConfig.ts +794 -792
  43. package/src/lib/authentication/providers/openid.tsx +6 -1
  44. package/src/lib/plugins/markdown/index.tsx +86 -82
  45. package/src/vite/dev-server.ts +9 -1
  46. package/src/vite/dev-ssr-config.ts +32 -0
  47. package/src/vite/plugin-config.ts +4 -2
  48. package/src/vite/plugin-docs.ts +213 -205
  49. package/docs/concepts/auth-provider-api-identities.md +0 -105
  50. package/docs/configuration/ai-assistants.md +0 -65
  51. package/docs/configuration/api-catalog.md +0 -109
  52. package/docs/configuration/authentication-auth0.md +0 -181
  53. package/docs/configuration/authentication-azure-ad.md +0 -245
  54. package/docs/configuration/authentication-clerk.md +0 -117
  55. package/docs/configuration/authentication-firebase.md +0 -69
  56. package/docs/configuration/authentication-pingfederate.md +0 -143
  57. package/docs/configuration/authentication-supabase.md +0 -233
  58. package/docs/configuration/build-configuration.mdx +0 -147
  59. package/docs/configuration/docs.md +0 -282
  60. package/docs/configuration/llms.md +0 -90
  61. package/docs/configuration/manifest.md +0 -129
  62. package/docs/configuration/navigation.mdx +0 -415
  63. package/docs/configuration/protected-routes.md +0 -150
  64. package/docs/configuration/search.md +0 -164
  65. package/docs/configuration/sentry.mdx +0 -44
  66. package/docs/configuration/site.md +0 -124
  67. package/docs/configuration/slots.mdx +0 -125
  68. package/docs/configuration/vite-config.md +0 -18
  69. package/docs/custom-plugins.md +0 -285
  70. package/docs/deploy/apache-nginx.md +0 -41
  71. package/docs/deploy/cloudflare-pages.md +0 -74
  72. package/docs/deploy/direct-upload.md +0 -17
  73. package/docs/deploy/github-pages.md +0 -49
  74. package/docs/deploy/vercel.md +0 -101
  75. package/docs/extending/events.md +0 -124
  76. package/docs/guides/environment-variables.md +0 -94
  77. package/docs/guides/managing-api-keys-and-identities.md +0 -89
  78. package/docs/guides/navigation-rules.mdx +0 -203
  79. package/docs/guides/processors.mdx +0 -234
  80. package/docs/guides/transforming-examples.md +0 -156
  81. package/docs/guides/using-multiple-apis.md +0 -87
  82. package/docs/plugins.md +0 -24
@@ -1,397 +1,98 @@
1
- ---
2
- title: API Reference
3
- sidebar_icon: square-library
4
- description:
5
- Learn how to configure the `apis` setting in APIToGo to generate API reference documentation from
6
- OpenAPI files, including file and URL references, versioning, customization options, and OpenAPI
7
- extensions.
8
- ---
9
-
10
- The `apis` configuration setting in the [APIToGo Configuration](./overview.md) file allows you to
11
- specify the OpenAPI document that you want to use to generate your API reference documentation.
12
-
13
- There are multiple ways to reference an API file in the configuration including using a URL or a
14
- local file path. The OpenAPI document can be in either JSON or YAML format.
15
-
16
- ## File Reference
17
-
18
- You can reference a local OpenAPI document by setting the `type` to `file` and providing the path to
19
- the file.
20
-
21
- ```ts title=config
22
- const config = {
23
- // ...
24
- apis: {
25
- type: "file",
26
- input: "./openapi.json", // Supports JSON and YAML files (ex. openapi.yaml)
27
- path: "/api",
28
- },
29
- // ...
30
- };
31
- ```
32
-
33
- ## URL Reference
34
-
35
- :::danger{title="Recommendation"}
36
-
37
- We strongly recommend using `type: "file"` for your OpenAPI schemas. When using URL based
38
- references, all schema processing occurs at runtime in the browser. This can cause noticeable
39
- performance issues with large OpenAPI documents and some features may not be fully supported due to
40
- the added complexity of runtime processing.
41
-
42
- :::
43
-
44
- If your OpenAPI document is accessible elsewhere via URL you can use this configuration, changing
45
- the `input` value to the URL of your own OpenAPI document (you can use the Rick & Morty API document
46
- if you want to test and play around):
47
-
48
- ```ts title=config
49
- const config = {
50
- // ...
51
- apis: {
52
- type: "url",
53
- input: "https://petstore3.swagger.io/api/v3/openapi.json",
54
- path: "/api",
55
- },
56
- // ...
57
- };
58
- ```
59
-
60
- :::caution{title="CORS Policy"}
61
-
62
- If you are using a URL to reference your OpenAPI document, you may need to ensure that the server
63
- hosting the document has the correct CORS policy in place to allow the APIToGo site to access it.
64
-
65
- :::
66
-
67
- ## Versioning
68
-
69
- ### File-based Versioning
70
-
71
- When using `type: "file"`, you can provide an array of file paths to create versioned API
72
- documentation. Version metadata is automatically extracted from each OpenAPI schema at build time:
73
-
74
- ```ts title=config
75
- const config = {
76
- apis: {
77
- type: "file",
78
- input: [
79
- // Order of the array determines the order of the versions
80
- "./openapi-v2.json",
81
- "./openapi-v1.json",
82
- ],
83
- path: "/api",
84
- },
85
- };
86
- ```
87
-
88
- If you need to override version metadata, you can specify it explicitly:
89
-
90
- ```ts title=config
91
- const config = {
92
- apis: {
93
- type: "file",
94
- input: [
95
- // Order of the array determines the order of the versions
96
- {
97
- path: "v2",
98
- label: "Version 2.0",
99
- input: "./openapi-v2.json",
100
- },
101
- {
102
- path: "v1",
103
- label: "Version 1.0",
104
- input: "./openapi-v1.json",
105
- },
106
- ],
107
- path: "/api",
108
- },
109
- };
110
- ```
111
-
112
- You can specify:
113
-
114
- - `input`: Path to the OpenAPI document (required)
115
- - `path`: Version identifier used in the URL path (e.g., `/api/v2`)
116
- - `label`: Optional display name for the version selector
117
-
118
- You can also mix strings and objects in the array - use strings for defaults and objects when you
119
- need to customize:
120
-
121
- ```ts title=config
122
- const config = {
123
- apis: {
124
- type: "file",
125
- input: [
126
- {
127
- path: "latest",
128
- label: "Latest (2.0)",
129
- input: "./openapi-v2.json",
130
- },
131
- "./openapi-v1.json", // Uses info.version from the document
132
- ],
133
- path: "/api",
134
- },
135
- };
136
- ```
137
-
138
- ### Splitting a Single Schema
139
-
140
- If you have one schema containing multiple API versions (e.g. `/v1/...` and `/v2/...` paths), you
141
- can split it into separate versions by appending query parameters to the input path:
142
-
143
- ```ts title=config
144
- const config = {
145
- apis: {
146
- type: "file",
147
- input: ["openapi.json?prefix=/v2", "openapi.json?prefix=/v1"],
148
- path: "/api",
149
- },
150
- };
151
- ```
152
-
153
- The query parameters are passed to [schema processors](../guides/processors) via the `params`
154
- argument, where you can filter the schema based on their values. See
155
- [Using Query Parameters to Split Schemas](../guides/processors#using-query-parameters-to-split-schemas)
156
- for a full example.
157
-
158
- ### URL-based Versioning
159
-
160
- When using `type: "url"`, you can provide an array of version configurations. Since URL-based
161
- schemas cannot be processed at build time, you must explicitly specify the version identifier and
162
- optional label:
163
-
164
- ```ts title=config
165
- const config = {
166
- apis: {
167
- type: "url",
168
- input: [
169
- {
170
- path: "v2",
171
- label: "Version 2.0",
172
- input: "https://api.example.com/openapi-v2.json",
173
- },
174
- {
175
- path: "v1",
176
- label: "Version 1.0",
177
- input: "https://api.example.com/openapi-v1.json",
178
- },
179
- ],
180
- path: "/api",
181
- },
182
- };
183
- ```
184
-
185
- Each URL version object requires:
186
-
187
- - `path`: Version identifier used in the URL path (e.g., `/api/v2`)
188
- - `input`: URL to the OpenAPI document
189
- - `label`: Optional display name for the version selector (defaults to `path` if not provided)
190
-
191
- ## Options
192
-
193
- The `options` field allows you to customize the API reference behavior:
194
-
195
- ```ts title=config
196
- const config = {
197
- apis: {
198
- type: "file",
199
- input: "./openapi.json",
200
- path: "/api",
201
- options: {
202
- examplesLanguage: "shell", // Default language for code examples
203
- supportedLanguages: [
204
- { label: "cURL", language: "shell" },
205
- { label: "JavaScript", language: "javascript" },
206
- ],
207
- disablePlayground: false, // Disable the interactive API playground
208
- disableSidecar: false, // Disable the sidecar completely
209
- showVersionSelect: "if-available", // Control version selector visibility
210
- expandAllTags: true, // Control initial expanded state of tag categories
211
- showInfoPage: true, // Show API information page as the index route
212
- schemaDownload: {
213
- enabled: true, // Enable schema download button
214
- },
215
- },
216
- },
217
- };
218
- ```
219
-
220
- Available options:
221
-
222
- - `examplesLanguage`: Set default language for code examples
223
- - `supportedLanguages`: Array of language options for code examples. Each option has `label`
224
- (display name) and `language` (code identifier)
225
- - `disablePlayground`: Disable the interactive API playground globally
226
- - `disableSidecar`: Disable the sidecar panel completely
227
- - `showVersionSelect`: Control version selector visibility
228
- - `"if-available"`: Show version selector only when multiple versions exist (default)
229
- - `"always"`: Always show version selector (disabled if only one version)
230
- - `"hide"`: Never show version selector
231
- - `expandAllTags`: Control initial expanded state of tag categories (default: `true`)
232
- - `showInfoPage`: Show the API information page as the index route (default: `true`). When disabled,
233
- navigating to the API root redirects to the first tag instead
234
- - `schemaDownload`: Enable schema download functionality. When enabled, displays a button allowing
235
- users to download the OpenAPI schema, copy it to clipboard, or open in a new tab.
236
- - `enabled`: Enable or disable the schema download button
237
- - `transformExamples`: Function to transform request/response examples before rendering. See
238
- [Transforming Examples](../guides/transforming-examples.md) for detailed usage
239
- - `generateCodeSnippet`: Function to generate custom code snippets for the API playground. See
240
- [Advanced Configuration](#advanced-configuration) below
241
-
242
- ## Default Options
243
-
244
- Instead of setting options for each API individually, you can use `defaults.apis` to set global
245
- defaults that apply to all APIs:
246
-
247
- ```ts title=config
248
- const config = {
249
- defaults: {
250
- apis: {
251
- examplesLanguage: "shell", // Default language for code examples
252
- disablePlayground: false, // Disable the interactive API playground
253
- disableSidecar: false, // Disable the sidecar completely
254
- showVersionSelect: "if-available", // Control version selector visibility
255
- expandAllTags: false, // Control initial expanded state of tag categories
256
- showInfoPage: true, // Show API information page as the index route
257
- schemaDownload: {
258
- enabled: true, // Enable schema download button
259
- },
260
- },
261
- },
262
- apis: {
263
- type: "file",
264
- input: "./openapi.json",
265
- path: "/api",
266
- },
267
- };
268
- ```
269
-
270
- Individual API options will override these defaults when specified.
271
-
272
- ## AI Assistants
273
-
274
- The schema download dropdown includes AI assistant options (Claude, ChatGPT) by default. You can
275
- customize or disable these using the top-level `aiAssistants` configuration. See
276
- [AI Assistants](./ai-assistants.md) for full documentation.
277
-
278
- ## Advanced Configuration
279
-
280
- ### Custom Code Snippets
281
-
282
- Use `generateCodeSnippet` to generate custom code snippets instead of the default HTTP examples.
283
- This is useful when you want to show SDK usage or language-specific implementations.
284
-
285
- ```tsx title=config
286
- const config: ApitogoConfig = {
287
- apis: {
288
- type: "file",
289
- input: "./openapi.json",
290
- path: "/api",
291
- options: {
292
- supportedLanguages: [
293
- { value: "js", label: "JavaScript" },
294
- { value: "python", label: "Python" },
295
- ],
296
- generateCodeSnippet: ({ selectedLang, selectedServer, operation, example }) => {
297
- if (operation.operationId === "createUser") {
298
- if (selectedLang === "js") {
299
- return `
300
- import { Client } from "@mycompany/sdk";
301
-
302
- const client = new Client({ baseUrl: "${selectedServer}" });
303
- const user = await client.createUser(${JSON.stringify(example, null, 2)});
304
- `.trim();
305
- }
306
- if (selectedLang === "python") {
307
- return `
308
- from mycompany import Client
309
-
310
- client = Client(base_url="${selectedServer}")
311
- user = client.create_user(${JSON.stringify(example)})
312
- `.trim();
313
- }
314
- }
315
- // Return false to use default snippet generation
316
- return false;
317
- },
318
- },
319
- },
320
- };
321
- ```
322
-
323
- The function receives:
324
-
325
- - `selectedLang`: Currently selected language from `supportedLanguages`
326
- - `selectedServer`: Currently selected server URL
327
- - `operation`: The OpenAPI operation object
328
- - `example`: The current request body example
329
-
330
- Return a string with the custom snippet, or `false` to fall back to default generation.
331
-
332
- ## Extensions
333
-
334
- APIToGo supports OpenAPI extensions (properties starting with `x-`) to customize behavior at
335
- different levels of your API documentation.
336
-
337
- ### Operations
338
-
339
- - `x-apitogo-playground-enabled`: Control playground visibility for an operation (default: `true`)
340
- - `x-explorer-enabled`: Alias for `x-apitogo-playground-enabled` for compatibility Example:
341
-
342
- ```json
343
- {
344
- "paths": {
345
- "/users": {
346
- "get": {
347
- "summary": "Get users",
348
- "x-apitogo-playground-enabled": false // Disable playground for this operation
349
- }
350
- }
351
- }
352
- }
353
- ```
354
-
355
- ### Tags
356
-
357
- Extensions that can be applied to tag categories:
358
-
359
- - `x-apitogo-collapsed`: Control initial collapsed state of a tag category (default: `true`)
360
- - `x-apitogo-collapsible`: Control if a tag category can be collapsed (default: `true`)
361
-
362
- Example:
363
-
364
- ```json
365
- {
366
- "tags": [
367
- {
368
- "name": "Users",
369
- "x-apitogo-collapsed": false
370
- }
371
- ]
372
- }
373
- ```
374
-
375
- ### Tag Groups
376
-
377
- Use `x-tagGroups` at the root of your OpenAPI document to group tags together in the navigation:
378
-
379
- ```yaml
380
- x-tagGroups:
381
- - name: Shipment
382
- tags:
383
- - Packages
384
- - Parcels
385
- - Letters
386
- ```
387
-
388
- ## Metadata
389
-
390
- Your API reference page metadata is sourced directly from your OpenAPI spec. The
391
- [`info`](https://spec.openapis.org/oas/v3.1.0#info-object) object is used set the corresponding tags
392
- in the page's `head`.
393
-
394
- | Metadata Property | OpenAPI Property | Comment |
395
- | ----------------- | ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
396
- | title | `info.title` | If `metadata.title` is set as a template string (ex. `%s - My Company`) it will be used |
397
- | description | `info.summary` | `info.summary` is preferred as it is shorter and plaintext-only, but APIToGo will fall back to the `info.description` if no summary is provided |
1
+ ---
2
+ title: API reference
3
+ sidebar_icon: book-open-check
4
+ description: >-
5
+ The portal's API page: made from the gateway's OpenAPI file, pointed at the gateway, with Try it,
6
+ and the OpenAPI extensions that shape it.
7
+ ---
8
+
9
+ The portal's **API Reference** page, at `/api`, is made from your gateway's OpenAPI file. There is
10
+ nothing to set up: when the project has a `gateway` with `specs`, the page is there.
11
+
12
+ ```json title=apitogo.config.json
13
+ {
14
+ "gateway": {
15
+ "origin": { "mode": "managed", "source": "server", "runtime": "nodejs" },
16
+ "specs": ["apitogo/apis/openapi.yaml"]
17
+ }
18
+ }
19
+ ```
20
+
21
+ The page uses the first file in `specs`. JSON and YAML both work.
22
+
23
+ ## What the page shows
24
+
25
+ The page shows your API as people call it, through the gateway, not as it runs behind it:
26
+
27
+ - **Servers** point at the gateway's address. Your origin's address never shows.
28
+ - **Security** says what the gateway checks: the API key header (`X-API-Key` unless
29
+ `gateway.policies.access.apiKeyHeader` names another), and a bearer token when `gateway.auth` is
30
+ set.
31
+ - Operations in `gateway.policies.operations.public` show no security, since they need no key.
32
+ - Operations in `gateway.policies.operations.deny` are left out.
33
+
34
+ Before the first deploy the gateway has no address yet, so `npx apitogo run` leaves the page out and
35
+ says so. It appears once the gateway is deployed.
36
+
37
+ ## Try it
38
+
39
+ Each operation has a **Try it** panel that sends a real request to the gateway. Under
40
+ **Authentication** it offers:
41
+
42
+ - **Your API key**: a key the visitor created on the API keys page, in this browser.
43
+ - **Signed-in user**: the visitor's own sign-in token. It is offered only when the gateway checks
44
+ tokens (`gateway.auth`), since a gateway that checks keys would answer it with 401.
45
+
46
+ Turn the panel off for one operation with `x-apitogo-playground-enabled: false` (below).
47
+
48
+ ## Who may read the OpenAPI file
49
+
50
+ The platform also publishes the file for other docs tools. By default anyone may read it. To limit
51
+ it to signed-in people:
52
+
53
+ ```json
54
+ "gateway": { "export": { "access": "authenticated" } }
55
+ ```
56
+
57
+ ## OpenAPI extensions
58
+
59
+ Fields starting with `x-` in your OpenAPI file change how the page looks.
60
+
61
+ ### Operations
62
+
63
+ - `x-apitogo-playground-enabled`: show Try it for this operation (default `true`).
64
+ `x-explorer-enabled` is the same.
65
+
66
+ ```yaml
67
+ paths:
68
+ /users:
69
+ get:
70
+ summary: Get users
71
+ x-apitogo-playground-enabled: false
72
+ ```
73
+
74
+ ### Tags
75
+
76
+ - `x-apitogo-collapsed`: the tag's section starts collapsed (default `true`).
77
+ - `x-apitogo-collapsible`: the tag's section can be collapsed (default `true`).
78
+
79
+ ```yaml
80
+ tags:
81
+ - name: Users
82
+ x-apitogo-collapsed: false
83
+ ```
84
+
85
+ ### Tag groups
86
+
87
+ Group tags in the sidebar with `x-tagGroups` at the root of the file:
88
+
89
+ ```yaml
90
+ x-tagGroups:
91
+ - name: Shipment
92
+ tags: [Packages, Parcels, Letters]
93
+ ```
94
+
95
+ ## Page title and description
96
+
97
+ The page's title and description come from the file's `info`: `info.title`, and `info.summary` (or
98
+ `info.description` when there is no summary).