@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,94 +0,0 @@
1
- ---
2
- title: Environment Variables
3
- sidebar_icon: table
4
- ---
5
-
6
- APIToGo uses Vite’s [env and mode](https://vite.dev/guide/env-and-mode) model, plus
7
- `APITOGO_CONFIG_*` overrides for `apitogo.config.json`.
8
-
9
- ## Portal / publish (`.env`)
10
-
11
- | Variable | Purpose |
12
- | --------------------------------------------- | ----------------------------------------------- |
13
- | `VITE_APITOGO_AUTHENTICATION_API_BASE_URL` | Dev-portal API base URL (client) |
14
- | `APITOGO_CONFIG_AUTHENTICATION__API_BASE_URL` | Same, via config override |
15
- | `APITOGO_CONFIG_AUTHENTICATION__OIDC__*` | OIDC authority / client id / secret for publish |
16
- | `APITOGO_CONFIG_AUTHENTICATION__STRIPE__*` | Stripe secret + webhook (paid plans) |
17
- | `APITOGO_CONFIG_DEMO_MODE` | `false` to disable local demo sign-in |
18
- | `APITOGO_CONFIG_SITE__TITLE` | Override `site.title` |
19
- | `APITOGO_CONFIG_PROJECT_ID` | Local project id override |
20
-
21
- Nested overrides use `__` path segments (SCREAMING_SNAKE). See
22
- [Manifest](../configuration/manifest.md).
23
-
24
- **Never commit** OIDC client secrets or Stripe keys. MCP never puts secrets in chat — you write them
25
- to `.env` before [go-live](../mcp/go-live.md) or `npx apitogo deploy`
26
- ([CLI go-live](../cli/go-live.md)).
27
-
28
- Example:
29
-
30
- ```sh
31
- VITE_APITOGO_AUTHENTICATION_API_BASE_URL=https://your-dev-portal-api.example.com
32
- APITOGO_CONFIG_AUTHENTICATION__OIDC__AUTHORITY=https://login.example.com
33
- APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_ID=your-client-id
34
- APITOGO_CONFIG_AUTHENTICATION__OIDC__CLIENT_SECRET=your-client-secret
35
- ```
36
-
37
- ## Client-visible custom vars (`APITOGO_PUBLIC_*`)
38
-
39
- Variables prefixed with `APITOGO_PUBLIC_` are exposed to client code under `import.meta.env`. Do not
40
- use this prefix for secrets.
41
-
42
- ```sh
43
- APITOGO_PUBLIC_PAGE_TITLE=My Page Title
44
- ```
45
-
46
- ```ts
47
- const title = import.meta.env.APITOGO_PUBLIC_PAGE_TITLE;
48
- ```
49
-
50
- In a TSX config you may also read `process.env` for build-time values (SPA providers, etc.):
51
-
52
- ```ts
53
- authentication: {
54
- type: "auth0",
55
- clientId: process.env.APITOGO_PUBLIC_AUTH_CLIENT_ID,
56
- domain: process.env.APITOGO_PUBLIC_AUTH_DOMAIN,
57
- }
58
- ```
59
-
60
- Prefer `dev-portal` + `APITOGO_CONFIG_*` for portal products.
61
-
62
- ## React components
63
-
64
- ```tsx
65
- export const MyComponent = () => {
66
- return <h1>{import.meta.env.APITOGO_PUBLIC_PAGE_TITLE}</h1>;
67
- };
68
- ```
69
-
70
- ## TypeScript IntelliSense
71
-
72
- Augment `ImportMetaEnv` in a declaration file (no imports in that file):
73
-
74
- ```typescript
75
- /// <reference types="@lukoweb/apitogo/client" />
76
-
77
- interface ImportMetaEnv {
78
- readonly APITOGO_PUBLIC_APP_TITLE: string;
79
- }
80
-
81
- interface ImportMeta {
82
- readonly env: ImportMetaEnv;
83
- }
84
- ```
85
-
86
- ## MCP host (agent machine)
87
-
88
- | Variable | Purpose |
89
- | ------------------------------------------- | ------------------------------------------------------------------- |
90
- | `APITOGO_API_KEY_ID` / `APITOGO_API_SECRET` | Required for MCP and CLI deploy/status/teardown |
91
- | `APITOGO_DOC_TOOL_PATH` | Optional local doc-tool for scaffold |
92
- | `APITOGO_CLI_PATH` | Optional local `@lukoweb/apitogo` / doc-tool checkout for MCP spawn |
93
-
94
- See [MCP overview](../mcp/overview.md) and [CLI overview](../cli/overview.md).
@@ -1,89 +0,0 @@
1
- ---
2
- title: Managing API Keys and Identities
3
- sidebar_label: API Keys and Identities
4
- sidebar_icon: key-square
5
- ---
6
-
7
- ## Portal products (APItoGo)
8
-
9
- For developer portals, enable API keys under **`modules.userPanel.apiKeys`** in
10
- `apitogo.config.json` (not a root `apiKeys` key):
11
-
12
- ```json
13
- {
14
- "modules": {
15
- "userPanel": {
16
- "enabled": true,
17
- "apiKeys": { "enabled": true }
18
- }
19
- }
20
- }
21
- ```
22
-
23
- With MCP, prefer `update_dev_portal_manifest`. Subscription / gateway keys for provisioned portals
24
- are issued by the APItoGo platform after sign-in; see
25
- [Authentication](../configuration/authentication.md) and [MCP go-live](../mcp/go-live.md).
26
-
27
- Legacy root `apiKeys: { enabled: true }` is still migrated on load into `modules.userPanel.apiKeys`.
28
-
29
- ## Custom API key UI plugin
30
-
31
- APIToGo includes a UI plugin for managing API consumers and keys (create, view, update, delete). You
32
- can point it at any backend by implementing callbacks / `ApiKeyService`.
33
-
34
- Enable and customize from TSX when you need custom create/list logic:
35
-
36
- ```typescript title=config
37
- const config = {
38
- apiKeys: {
39
- enabled: true,
40
- createKey: async ({ apiKey, context, auth }) => {
41
- const createApiKeyRequest = new Request("https://api.example.com/v1/developer/api-key", {
42
- method: "POST",
43
- body: JSON.stringify({ apiKey }),
44
- });
45
- const signedRequest = await context.signRequest(createApiKeyRequest);
46
- const response = await fetch(signedRequest);
47
- if (!response.ok) {
48
- throw new Error("Could not create API Key");
49
- }
50
- return true;
51
- },
52
- },
53
- };
54
- ```
55
-
56
- The account UI is typically available under `/account/settings/api-keys` when the user panel is
57
- enabled.
58
-
59
- ## Custom `ApiKeyService`
60
-
61
- ```typescript
62
- interface ApiKeyService {
63
- getConsumers: (context: ApitogoContext) => Promise<ApiConsumer[]>;
64
- rollKey?: (consumerId: string, context: ApitogoContext) => Promise<void>;
65
- deleteKey?: (consumerId: string, keyId: string, context: ApitogoContext) => Promise<void>;
66
- updateConsumer?: (
67
- consumer: { id: string; label?: string },
68
- context: ApitogoContext,
69
- ) => Promise<void>;
70
- getUsage?: (apiKeys: string[], context: ApitogoContext) => Promise<void>;
71
- createKey?: ({
72
- apiKey,
73
- context,
74
- auth,
75
- }: {
76
- apiKey: { description: string; expiresOn?: string };
77
- context: ApitogoContext;
78
- auth: UseAuthReturn;
79
- }) => Promise<void>;
80
- }
81
- ```
82
-
83
- Wire the service through the `apiKeys` config object in TSX (same callbacks as above). Prefer
84
- `modules.userPanel.apiKeys.enabled` in JSON for portal toggles.
85
-
86
- ## Related
87
-
88
- - [Auth providers and API identities](../concepts/auth-provider-api-identities.md)
89
- - [Manifest](../configuration/manifest.md)
@@ -1,203 +0,0 @@
1
- ---
2
- title: Navigation Rules
3
- sidebar_icon: list-tree
4
- ---
5
-
6
- import {
7
- LayersPlusIcon,
8
- PencilIcon,
9
- SortAscIcon,
10
- ArrowUpDownIcon,
11
- TrashIcon,
12
- } from "@lukoweb/apitogo/icons";
13
-
14
- Plugins like the OpenAPI plugin generate sidebar navigation automatically. Navigation rules let you
15
- customize that generated sidebar without changing the source. You can:
16
-
17
- - <LayersPlusIcon className="inline-block size-3.5 me-1" /> **Insert** items at a specific position
18
- - <PencilIcon className="inline-block size-3.5 me-1" /> **Modify** items
19
- - <SortAscIcon className="inline-block size-3.5 me-1" /> **Sort** items with a custom comparator
20
- - <ArrowUpDownIcon className="inline-block size-3.5 me-1" /> **Move** items to a different position
21
- - <TrashIcon className="inline-block size-3.5 me-1" /> **Remove** items
22
-
23
- ## Setup
24
-
25
- Add a `navigationRules` array to your `apitogo.config.json`:
26
-
27
- ```tsx
28
- import type { ApitogoConfig } from "@lukoweb/apitogo";
29
-
30
- const config: ApitogoConfig = {
31
- apis: [{ type: "file", input: "./api.json", path: "api-shipments" }],
32
- navigation: [{ type: "link", label: "Shipments", to: "/api-shipments" }],
33
- navigationRules: [
34
- // rules go here
35
- ],
36
- };
37
- ```
38
-
39
- ## Inserting docs
40
-
41
- Use `type: "insert"` to add items before or after a matched sidebar item. The `match` string uses
42
- the tab label as the first segment and navigates into the sidebar tree.
43
-
44
- ```tsx
45
- navigationRules: [
46
- {
47
- type: "insert",
48
- match: "Shipments/0",
49
- position: "before",
50
- items: [
51
- {
52
- type: "doc",
53
- file: "api-shipments/getting-started",
54
- icon: "plane-takeoff",
55
- },
56
- ],
57
- },
58
- ],
59
- ```
60
-
61
- This inserts a "Getting Started" doc before the first item in the Shipments sidebar.
62
-
63
- ![Inserting a doc before the first sidebar item](./navigation-rules/insert-doc.png)
64
-
65
- The MDX file lives at `pages/api-shipments/getting-started.mdx` (under your configured docs
66
- directory, matching the API's base path).
67
-
68
- ## Adding links
69
-
70
- You can insert external or internal links the same way:
71
-
72
- ```tsx
73
- {
74
- type: "insert",
75
- match: "Shipments/-1",
76
- position: "after",
77
- items: [
78
- {
79
- type: "link",
80
- label: "System Status",
81
- to: "/status",
82
- icon: "satellite",
83
- },
84
- ],
85
- }
86
- ```
87
-
88
- The `-1` index targets the last item, and `position: "after"` places the link at the very end of the
89
- sidebar.
90
-
91
- ![Inserting a link after the last sidebar item](./navigation-rules/insert-doc-end.png)
92
-
93
- ## Modifying items
94
-
95
- Use `type: "modify"` to change properties of existing sidebar items like their icon, label, or
96
- collapsed state:
97
-
98
- ```tsx
99
- {
100
- type: "modify",
101
- match: "Shipments/Shipment Management",
102
- set: { icon: "box", collapsed: true },
103
- }
104
- ```
105
-
106
- ![Modifying a sidebar item's icon](./navigation-rules/modify-item.png)
107
-
108
- ## Removing items
109
-
110
- `type: "remove"` hides items from the sidebar. This is rarely needed since it's usually better to
111
- fix the underlying source, but can be useful as a quick workaround:
112
-
113
- ```tsx
114
- {
115
- type: "remove",
116
- match: "Shipments/Deprecated Endpoint",
117
- }
118
- ```
119
-
120
- ## Sorting items
121
-
122
- Use `type: "sort"` to reorder children of a category alphabetically or with any custom comparator:
123
-
124
- ```tsx
125
- {
126
- type: "sort",
127
- match: "Shipments",
128
- by: (a, b) => a.label.localeCompare(b.label),
129
- }
130
- ```
131
-
132
- The `by` function receives two navigation items and works like a standard `Array.sort` comparator.
133
-
134
- ## Moving items
135
-
136
- Use `type: "move"` to relocate an existing item to a different position in the sidebar:
137
-
138
- ```tsx
139
- {
140
- type: "move",
141
- match: "Shipments/Track a Shipment",
142
- to: "Shipments/0",
143
- position: "before",
144
- }
145
- ```
146
-
147
- This moves "Track a Shipment" to the top of the Shipments category. You can also move items between
148
- different levels, for example from inside a category to the root level.
149
-
150
- ## Rule order
151
-
152
- Rules are applied sequentially, so order matters. For example, sorting first and then inserting
153
- places the new item at an exact position in the already-sorted list. Inserting first and then
154
- sorting will sort the new item along with everything else.
155
-
156
- ## Complete example
157
-
158
- This is the configuration used in the Cosmo Cargo demo shown above:
159
-
160
- ```tsx
161
- navigationRules: [
162
- {
163
- type: "sort",
164
- match: "Shipments",
165
- by: (a, b) => a.label.localeCompare(b.label),
166
- },
167
- {
168
- type: "insert",
169
- match: "Shipments/Shipment",
170
- position: "before",
171
- items: [
172
- {
173
- type: "doc",
174
- file: "api-shipments/getting-started",
175
- icon: "plane-takeoff",
176
- },
177
- ],
178
- },
179
- {
180
- type: "insert",
181
- match: "Shipments/-1",
182
- position: "after",
183
- items: [
184
- {
185
- type: "link",
186
- label: "System Status",
187
- to: "/status",
188
- icon: "satellite",
189
- },
190
- ],
191
- },
192
- {
193
- type: "modify",
194
- match: "Shipments/1",
195
- set: { icon: "box" },
196
- },
197
- ],
198
- ```
199
-
200
- ## Match syntax reference
201
-
202
- For the full match syntax including label matching, index selectors, and nested paths, see the
203
- [Navigation Rules reference](/docs/configuration/navigation#navigation-rules).
@@ -1,234 +0,0 @@
1
- ---
2
- sidebar_icon: cpu
3
- ---
4
-
5
- # Schema Processors
6
-
7
- Schema processors are functions that transform your OpenAPI schemas before they are used in the
8
- documentation. They are defined in your `apitogo.build.ts` file and can be used to modify schemas in
9
- various ways.
10
-
11
- :::tip
12
-
13
- For information on how to configure processors in your project, see the
14
- [Build Configuration](../configuration/build-configuration) guide.
15
-
16
- :::
17
-
18
- ## Built-in Processors
19
-
20
- APIToGo provides several built-in processors that you can use to transform your schemas:
21
-
22
- ### `removeExtensions`
23
-
24
- Removes OpenAPI extensions (`x-` prefixed properties) from your schema:
25
-
26
- ```ts
27
- import { removeExtensions } from "@lukoweb/apitogo/processors/removeExtensions";
28
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
29
-
30
- const buildConfig: ApitogoBuildConfig = {
31
- processors: [
32
- // Remove all x- prefixed properties
33
- removeExtensions(),
34
-
35
- // Remove specific extensions
36
- removeExtensions({
37
- keys: ["x-internal", "x-deprecated"],
38
- }),
39
-
40
- // Remove extensions based on a custom filter
41
- removeExtensions({
42
- shouldRemove: (key) => key.startsWith("x-internal"),
43
- }),
44
- ],
45
- };
46
-
47
- export default buildConfig;
48
- ```
49
-
50
- ### `removeParameters`
51
-
52
- Removes parameters from your schema:
53
-
54
- ```ts
55
- import { removeParameters } from "@lukoweb/apitogo/processors/removeParameters";
56
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
57
-
58
- const buildConfig: ApitogoBuildConfig = {
59
- processors: [
60
- // Remove parameters by name
61
- removeParameters({
62
- names: ["apiKey", "secret"],
63
- }),
64
-
65
- // Remove parameters by location
66
- removeParameters({
67
- in: ["header", "query"],
68
- }),
69
-
70
- // Remove parameters based on a custom filter
71
- removeParameters({
72
- shouldRemove: ({ parameter }) => parameter["x-internal"],
73
- }),
74
- ],
75
- };
76
-
77
- export default buildConfig;
78
- ```
79
-
80
- ### `removePaths`
81
-
82
- Removes paths or operations from your schema:
83
-
84
- ```ts
85
- import { removePaths } from "@lukoweb/apitogo/processors/removePaths";
86
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
87
-
88
- const buildConfig: ApitogoBuildConfig = {
89
- processors: [
90
- // Remove entire paths
91
- removePaths({
92
- paths: {
93
- "/internal": true,
94
- "/admin": ["get", "post"],
95
- },
96
- }),
97
-
98
- // Remove paths based on a custom filter
99
- removePaths({
100
- shouldRemove: ({ path, method, operation }) => operation["x-internal"],
101
- }),
102
- ],
103
- };
104
-
105
- export default buildConfig;
106
- ```
107
-
108
- :::info
109
-
110
- If you are missing a processor that you think should be built-in, please don't hesitate to
111
- [open an issue on GitHub](https://github.com/lukoweb/apitogo-doc-tool/issues/new).
112
-
113
- :::
114
-
115
- ## Custom Processors
116
-
117
- You can also create your own processors. Here's a simple example that adds a description to all
118
- operations:
119
-
120
- ```ts
121
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
122
-
123
- async function addDescriptionProcessor({ schema }) {
124
- if (!schema.paths) return schema;
125
-
126
- // Add a description to all operations
127
- Object.values(schema.paths).forEach((path) => {
128
- Object.values(path).forEach((operation) => {
129
- if (typeof operation === "object") {
130
- operation.description = "This is a public API endpoint";
131
- }
132
- });
133
- });
134
-
135
- return schema;
136
- }
137
-
138
- const buildConfig: ApitogoBuildConfig = {
139
- processors: [addDescriptionProcessor],
140
- };
141
-
142
- export default buildConfig;
143
- ```
144
-
145
- ### Adding Server URLs
146
-
147
- ```ts
148
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
149
-
150
- async function addServerUrl({ schema }) {
151
- return {
152
- ...schema,
153
- servers: [{ url: "https://api.example.com" }],
154
- };
155
- }
156
-
157
- const buildConfig: ApitogoBuildConfig = {
158
- processors: [addServerUrl],
159
- };
160
-
161
- export default buildConfig;
162
- ```
163
-
164
- ## Using Query Parameters to Split Schemas
165
-
166
- You can use the same OpenAPI file multiple times with different processing by appending query
167
- parameters to the file input string. These parameters are passed to your processors via the `params`
168
- argument, allowing you to filter or transform the schema differently for each variant.
169
-
170
- This is useful when you have a single schema containing multiple API versions or groups that you
171
- want to split into separate pages.
172
-
173
- Plain strings work out of the box. Version paths and dropdown labels are auto-generated from the
174
- query parameter values. For more control, use the object form with explicit `path` and `label`.
175
-
176
- ```ts title=config
177
- const config = {
178
- apis: {
179
- type: "file",
180
- input: [
181
- // Object form: explicit path and label
182
- {
183
- input: "openapi.json?prefix=/v2",
184
- path: "latest",
185
- label: "Latest (v2)",
186
- },
187
- // Object form: explicit path, label auto-generated from params
188
- {
189
- input: "openapi.json?prefix=/v1.1",
190
- path: "v1.1",
191
- },
192
- // Plain string: both path and label auto-generated from params
193
- "openapi.json?prefix=/v1",
194
- ],
195
- path: "/api",
196
- },
197
- };
198
- ```
199
-
200
- ```ts title=apitogo.build.ts
201
- import type { ApitogoBuildConfig } from "@lukoweb/apitogo";
202
-
203
- const buildConfig: ApitogoBuildConfig = {
204
- processors: [
205
- ({ schema, params }) => {
206
- const prefix = params.prefix;
207
- if (!prefix) return schema;
208
-
209
- return {
210
- ...schema,
211
- paths: Object.fromEntries(
212
- Object.entries(schema.paths ?? {}).filter(([path]) => path.startsWith(prefix)),
213
- ),
214
- };
215
- },
216
- ],
217
- };
218
-
219
- export default buildConfig;
220
- ```
221
-
222
- Each version tab will show only the endpoints matching that prefix. The query parameters are
223
- arbitrary key-value pairs that you define and consume in your processors.
224
-
225
- When schema download is enabled, param variants serve the processed (filtered) schema rather than
226
- the original file.
227
-
228
- ## Best Practices
229
-
230
- - **Handle missing properties**: Check for the existence of properties before accessing them
231
- - **Return the schema**: Always return the transformed schema, even if no changes were made
232
- - **Use async/await**: Processors can be async functions, which is useful for more complex
233
- transformations
234
- - **Chain processors**: Processors are executed in order, so you can chain multiple transformations