@navios/openapi-fastify 0.7.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 (42) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/LICENSE +8 -0
  3. package/README.md +311 -0
  4. package/dist/src/index.d.mts +6 -0
  5. package/dist/src/index.d.mts.map +1 -0
  6. package/dist/src/openapi-fastify.plugin.d.mts +74 -0
  7. package/dist/src/openapi-fastify.plugin.d.mts.map +1 -0
  8. package/dist/src/schemas/index.d.mts +2 -0
  9. package/dist/src/schemas/index.d.mts.map +1 -0
  10. package/dist/src/schemas/openapi-fastify-options.schema.d.mts +113 -0
  11. package/dist/src/schemas/openapi-fastify-options.schema.d.mts.map +1 -0
  12. package/dist/src/utils/apply-global-prefix.util.d.mts +26 -0
  13. package/dist/src/utils/apply-global-prefix.util.d.mts.map +1 -0
  14. package/dist/src/utils/index.d.mts +2 -0
  15. package/dist/src/utils/index.d.mts.map +1 -0
  16. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  17. package/dist/tsconfig.tsbuildinfo +1 -0
  18. package/dist/tsdown.config.d.mts +3 -0
  19. package/dist/tsdown.config.d.mts.map +1 -0
  20. package/dist/vitest.config.d.mts +3 -0
  21. package/dist/vitest.config.d.mts.map +1 -0
  22. package/lib/index.cjs +233 -0
  23. package/lib/index.cjs.map +1 -0
  24. package/lib/index.d.cts +214 -0
  25. package/lib/index.d.cts.map +1 -0
  26. package/lib/index.d.mts +214 -0
  27. package/lib/index.d.mts.map +1 -0
  28. package/lib/index.mjs +185 -0
  29. package/lib/index.mjs.map +1 -0
  30. package/package.json +48 -0
  31. package/project.json +66 -0
  32. package/src/index.mts +41 -0
  33. package/src/openapi-fastify.plugin.mts +167 -0
  34. package/src/schemas/index.mts +10 -0
  35. package/src/schemas/openapi-fastify-options.schema.mts +129 -0
  36. package/src/utils/apply-global-prefix.util.mts +52 -0
  37. package/src/utils/index.mts +1 -0
  38. package/tsconfig.json +14 -0
  39. package/tsconfig.lib.json +8 -0
  40. package/tsconfig.spec.json +7 -0
  41. package/tsdown.config.mts +35 -0
  42. package/vitest.config.mts +11 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,34 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.7.0] - 2025-12-18
9
+
10
+ ### Added
11
+
12
+ - **Fastify OpenAPI Provider**: Initial release of the Fastify provider for OpenAPI documentation
13
+ - **Scalar UI Integration**: Interactive Scalar UI for exploring API documentation
14
+ - **OpenAPI Plugin**: `defineOpenApiPlugin()` function for easy integration with Navios applications
15
+ - **Automatic Spec Generation**: Automatic OpenAPI specification generation from Navios controllers
16
+ - **JSON Endpoint**: `/openapi.json` endpoint serving OpenAPI specification in JSON format
17
+ - **YAML Endpoint**: `/openapi.yaml` endpoint serving OpenAPI specification in YAML format (configurable)
18
+ - **Documentation UI**: `/docs` endpoint serving interactive Scalar UI documentation
19
+ - **Customizable Configuration**: Extensive configuration options:
20
+ - OpenAPI info (title, version, description, contact, license, termsOfService)
21
+ - Server definitions
22
+ - Security schemes and global security requirements
23
+ - Custom tags with descriptions
24
+ - Customizable paths for JSON, YAML, and docs endpoints
25
+ - Scalar UI theme configuration (default, alternate, moon, purple, solarized)
26
+ - Option to disable YAML endpoint
27
+ - **Fastify Plugin Integration**: Seamless integration with Fastify's plugin system
28
+ - **Global Prefix Support**: Automatic respect for Fastify's global prefix configuration
29
+ - **Type Safety**: Full TypeScript support with comprehensive type definitions
30
+ - **All Core Decorators**: Full support for all decorators from `@navios/openapi`:
31
+ - `@ApiTag`, `@ApiOperation`, `@ApiSummary`, `@ApiDeprecated`, `@ApiSecurity`, `@ApiExclude`, `@ApiStream`
32
+ - **Endpoint Type Support**: Support for all endpoint types (standard, multipart, stream)
33
+ - **Zod Schema Support**: Automatic conversion of Zod schemas to OpenAPI schemas
34
+
package/LICENSE ADDED
@@ -0,0 +1,8 @@
1
+ Copyright 2025 Oleksandr Hanzha
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8
+
package/README.md ADDED
@@ -0,0 +1,311 @@
1
+ # @navios/openapi-fastify
2
+
3
+ Fastify provider for OpenAPI documentation with Scalar UI integration.
4
+
5
+ This package provides OpenAPI documentation generation for Navios applications running on Fastify, including automatic endpoint discovery, schema conversion, and Scalar UI integration for interactive API documentation.
6
+
7
+ ## Overview
8
+
9
+ `@navios/openapi-fastify` extends `@navios/openapi` with Fastify-specific integration, providing:
10
+
11
+ - Scalar UI for interactive API documentation
12
+ - Automatic OpenAPI spec generation
13
+ - JSON and YAML endpoints for the OpenAPI specification
14
+ - Seamless integration with Fastify's plugin system
15
+
16
+ ## Features
17
+
18
+ - Automatic endpoint discovery from Navios controllers
19
+ - Zod schema to OpenAPI schema conversion
20
+ - Interactive Scalar UI documentation
21
+ - OpenAPI JSON and YAML endpoints
22
+ - Customizable themes and configuration
23
+ - Support for all endpoint types (standard, multipart, stream)
24
+ - Type-safe configuration
25
+ - Fastify plugin integration
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ npm install @navios/openapi @navios/openapi-fastify
31
+ ```
32
+
33
+ Or with yarn:
34
+
35
+ ```bash
36
+ yarn add @navios/openapi @navios/openapi-fastify
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ ### Basic Setup
42
+
43
+ ```ts
44
+ import { defineFastifyEnvironment } from '@navios/adapter-fastify'
45
+ import { Module, NaviosFactory } from '@navios/core'
46
+ import { defineOpenApiPlugin } from '@navios/openapi-fastify'
47
+ import { ApiTag, ApiOperation } from '@navios/openapi'
48
+
49
+ import { AppModule } from './app.module.js'
50
+
51
+ async function bootstrap() {
52
+ const app = await NaviosFactory.create(AppModule, {
53
+ adapter: defineFastifyEnvironment(),
54
+ })
55
+
56
+ app.usePlugin(
57
+ defineOpenApiPlugin({
58
+ info: {
59
+ title: 'My API',
60
+ version: '1.0.0',
61
+ description: 'API documentation',
62
+ },
63
+ }),
64
+ )
65
+
66
+ await app.init()
67
+ await app.listen({ port: 3000 })
68
+
69
+ console.log('API docs available at http://localhost:3000/docs')
70
+ }
71
+
72
+ bootstrap()
73
+ ```
74
+
75
+ ### Complete Example
76
+
77
+ ```ts
78
+ import { defineFastifyEnvironment } from '@navios/adapter-fastify'
79
+ import { builder } from '@navios/builder'
80
+ import {
81
+ Controller,
82
+ Endpoint,
83
+ EndpointParams,
84
+ Module,
85
+ NaviosFactory,
86
+ } from '@navios/core'
87
+ import { defineOpenApiPlugin } from '@navios/openapi-fastify'
88
+ import { ApiOperation, ApiTag } from '@navios/openapi'
89
+ import { z } from 'zod'
90
+
91
+ const API = builder()
92
+
93
+ const userSchema = z.object({
94
+ id: z.string(),
95
+ name: z.string(),
96
+ email: z.string().email(),
97
+ })
98
+
99
+ export const getUser = API.declareEndpoint({
100
+ method: 'GET',
101
+ url: '/users/$userId',
102
+ responseSchema: userSchema,
103
+ })
104
+
105
+ @Controller()
106
+ @ApiTag('Users', 'User management operations')
107
+ class UserController {
108
+ @Endpoint(getUser)
109
+ @ApiOperation({
110
+ summary: 'Get user by ID',
111
+ description: 'Retrieves a user by their unique identifier.',
112
+ })
113
+ async getUser(params: EndpointParams<typeof getUser>) {
114
+ return {
115
+ id: params.urlParams.userId,
116
+ name: 'John',
117
+ email: 'john@example.com',
118
+ }
119
+ }
120
+ }
121
+
122
+ @Module({ controllers: [UserController] })
123
+ class AppModule {}
124
+
125
+ async function bootstrap() {
126
+ const app = await NaviosFactory.create(AppModule, {
127
+ adapter: defineFastifyEnvironment(),
128
+ })
129
+
130
+ app.usePlugin(
131
+ defineOpenApiPlugin({
132
+ info: {
133
+ title: 'User API',
134
+ version: '1.0.0',
135
+ },
136
+ securitySchemes: {
137
+ bearerAuth: {
138
+ type: 'http',
139
+ scheme: 'bearer',
140
+ },
141
+ },
142
+ }),
143
+ )
144
+
145
+ await app.init()
146
+ await app.listen({ port: 3000 })
147
+ console.log('API docs: http://localhost:3000/docs')
148
+ }
149
+
150
+ bootstrap()
151
+ ```
152
+
153
+ ### Advanced Configuration
154
+
155
+ ```ts
156
+ app.usePlugin(
157
+ defineOpenApiPlugin({
158
+ info: {
159
+ title: 'My API',
160
+ version: '1.0.0',
161
+ description: 'Complete API documentation',
162
+ termsOfService: 'https://example.com/terms',
163
+ contact: {
164
+ name: 'API Support',
165
+ url: 'https://example.com/support',
166
+ email: 'support@example.com',
167
+ },
168
+ license: {
169
+ name: 'MIT',
170
+ url: 'https://opensource.org/licenses/MIT',
171
+ },
172
+ },
173
+ servers: [
174
+ { url: 'http://localhost:3000', description: 'Development' },
175
+ { url: 'https://api.example.com', description: 'Production' },
176
+ ],
177
+ securitySchemes: {
178
+ bearerAuth: {
179
+ type: 'http',
180
+ scheme: 'bearer',
181
+ bearerFormat: 'JWT',
182
+ },
183
+ apiKey: {
184
+ type: 'apiKey',
185
+ in: 'header',
186
+ name: 'X-API-Key',
187
+ },
188
+ },
189
+ security: [{ bearerAuth: [] }], // Global security requirement
190
+ tags: [
191
+ { name: 'Users', description: 'User management' },
192
+ { name: 'Orders', description: 'Order processing' },
193
+ ],
194
+ jsonPath: '/openapi.json',
195
+ yamlPath: '/openapi.yaml',
196
+ docsPath: '/docs',
197
+ scalar: {
198
+ theme: 'purple',
199
+ },
200
+ }),
201
+ )
202
+ ```
203
+
204
+ ## Configuration Options
205
+
206
+ ### Path Configuration
207
+
208
+ | Option | Default | Description |
209
+ | ---------- | --------------- | -------------------------- |
210
+ | `jsonPath` | `/openapi.json` | Path to serve OpenAPI JSON |
211
+ | `yamlPath` | `/openapi.yaml` | Path to serve OpenAPI YAML |
212
+ | `docsPath` | `/docs` | Path to serve Scalar UI |
213
+ | `disableYaml` | `false` | Disable YAML endpoint |
214
+
215
+ ### Scalar Themes
216
+
217
+ The `scalar.theme` option accepts: `'default'`, `'alternate'`, `'moon'`, `'purple'`, `'solarized'`.
218
+
219
+ ## Decorators
220
+
221
+ All decorators from `@navios/openapi` are available:
222
+
223
+ - `@ApiTag` - Group endpoints under tags
224
+ - `@ApiOperation` - Full operation metadata
225
+ - `@ApiSummary` - Quick summary
226
+ - `@ApiDeprecated` - Mark as deprecated
227
+ - `@ApiSecurity` - Security requirements
228
+ - `@ApiExclude` - Exclude from docs
229
+ - `@ApiStream` - Stream endpoint metadata
230
+
231
+ See [@navios/openapi](../openapi/README.md) for detailed decorator documentation.
232
+
233
+ ## Endpoints
234
+
235
+ After setup, the following endpoints are automatically available:
236
+
237
+ - `GET /docs` - Interactive Scalar UI documentation
238
+ - `GET /openapi.json` - OpenAPI specification in JSON format
239
+ - `GET /openapi.yaml` - OpenAPI specification in YAML format (if enabled)
240
+
241
+ ## Global Prefix Support
242
+
243
+ The plugin automatically respects Fastify's global prefix configuration:
244
+
245
+ ```ts
246
+ const app = await NaviosFactory.create(AppModule, {
247
+ adapter: defineFastifyEnvironment(),
248
+ })
249
+
250
+ app.setGlobalPrefix('/api')
251
+
252
+ app.usePlugin(
253
+ defineOpenApiPlugin({
254
+ info: { title: 'My API', version: '1.0.0' },
255
+ }),
256
+ )
257
+
258
+ // Documentation will be available at:
259
+ // - /api/docs
260
+ // - /api/openapi.json
261
+ // - /api/openapi.yaml
262
+ ```
263
+
264
+ ## Requirements
265
+
266
+ - **Runtime**: Node.js 18+
267
+ - **Dependencies**:
268
+ - `@navios/adapter-fastify` - Fastify adapter for Navios
269
+ - `@navios/core` - Core Navios framework
270
+ - `@navios/openapi` - Core OpenAPI package
271
+ - `fastify` ^5.0.0 - Fastify web framework
272
+ - `zod` ^3.25.0 || ^4.0.0 - Schema validation
273
+
274
+ ## Features
275
+
276
+ - **Automatic Discovery**: Discovers all endpoints from your controllers
277
+ - **Schema Conversion**: Converts Zod schemas to OpenAPI schemas automatically
278
+ - **Interactive UI**: Beautiful Scalar UI for exploring your API
279
+ - **Type Safety**: Full TypeScript support with comprehensive types
280
+ - **Customizable**: Extensive configuration options
281
+ - **Production Ready**: Battle-tested in production environments
282
+ - **Fastify Integration**: Seamless integration with Fastify's plugin system
283
+
284
+ ## Examples
285
+
286
+ For complete working examples, see:
287
+
288
+ - [OpenAPI Examples](../../examples/openapi/src/main.mts) - Full Fastify example
289
+ - [OpenAPI Guide](../../apps/docs/docs/server/guides/openapi.md) - Comprehensive documentation
290
+
291
+ ## Documentation
292
+
293
+ For complete documentation on using OpenAPI with Navios, see:
294
+
295
+ - [OpenAPI Guide](../../apps/docs/docs/server/guides/openapi.md)
296
+ - [@navios/openapi Core Package](../openapi/README.md)
297
+ - [Controllers & Endpoints](../core/docs/controllers.md)
298
+
299
+ ## Comparison with Bun Provider
300
+
301
+ | Feature | Fastify Provider | Bun Provider |
302
+ | ----------- | ---------------- | --------------- |
303
+ | Runtime | Node.js | Bun |
304
+ | Performance | High | Very High |
305
+ | UI | Scalar | Scalar |
306
+ | Setup | Simple | Simple |
307
+ | Themes | 5 themes | 5 themes |
308
+ | Ecosystem | Rich | Growing |
309
+
310
+ Both providers offer the same features and API - choose based on your runtime environment.
311
+
@@ -0,0 +1,6 @@
1
+ export { defineOpenApiPlugin, OpenApiFastifyPlugin, type FastifyOpenApiPluginOptions, type ScalarOptions, type ScalarTheme, } from './openapi-fastify.plugin.mjs';
2
+ export { fastifyOpenApiPluginOptionsSchema, scalarOptionsSchema, scalarThemeSchema, scalarMetaDataSchema, } from './schemas/index.mjs';
3
+ export { applyGlobalPrefix } from './utils/index.mjs';
4
+ export type { OpenApiGeneratorOptions, OpenApiEndpointMetadata, ApiOperationOptions, ApiTagOptions, ApiStreamOptions, ApiDeprecatedOptions, ApiSecurityRequirement, } from '@navios/openapi';
5
+ export { ApiTag, ApiOperation, ApiSummary, ApiDeprecated, ApiSecurity, ApiExclude, ApiStream, } from '@navios/openapi';
6
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/index.mts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,8BAA8B,CAAA;AAGrC,OAAO,EACL,iCAAiC,EACjC,mBAAmB,EACnB,iBAAiB,EACjB,oBAAoB,GACrB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAGrD,YAAY,EACV,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,sBAAsB,GACvB,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,GACV,MAAM,iBAAiB,CAAA"}
@@ -0,0 +1,74 @@
1
+ import type { NaviosPlugin, PluginContext, PluginDefinition } from '@navios/core';
2
+ import type { OpenApiGeneratorOptions } from '@navios/openapi';
3
+ import type { FastifyOpenApiPluginOptionsBase, ScalarOptions, ScalarTheme } from './schemas/index.mjs';
4
+ /**
5
+ * Combined options for the Fastify OpenAPI plugin.
6
+ * Extends OpenApiGeneratorOptions with Fastify-specific settings.
7
+ */
8
+ export interface FastifyOpenApiPluginOptions extends OpenApiGeneratorOptions, Partial<FastifyOpenApiPluginOptionsBase> {
9
+ }
10
+ /**
11
+ * Class-based OpenAPI Fastify plugin that integrates with Navios plugin system.
12
+ *
13
+ * This plugin:
14
+ * - Scans all registered modules for endpoints
15
+ * - Generates an OpenAPI 3.1 document
16
+ * - Serves the document as JSON and optionally YAML
17
+ * - Provides Scalar UI for interactive documentation
18
+ */
19
+ export declare class OpenApiFastifyPlugin implements NaviosPlugin<FastifyOpenApiPluginOptions> {
20
+ readonly name = "openapi-fastify";
21
+ register(context: PluginContext, options: FastifyOpenApiPluginOptions): Promise<void>;
22
+ /**
23
+ * Generates the Scalar API Reference HTML document.
24
+ *
25
+ * @param specUrl - URL to the OpenAPI JSON specification
26
+ * @param options - Scalar UI configuration options
27
+ * @returns Complete HTML document string
28
+ */
29
+ private generateScalarHtml;
30
+ }
31
+ /**
32
+ * Creates a plugin definition for the OpenAPI Fastify plugin.
33
+ *
34
+ * @param options - Plugin configuration options
35
+ * @returns Plugin definition to pass to `app.usePlugin()`
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * import { NaviosFactory } from '@navios/core'
40
+ * import { defineFastifyEnvironment } from '@navios/adapter-fastify'
41
+ * import { defineOpenApiPlugin } from '@navios/openapi-fastify'
42
+ *
43
+ * const app = await NaviosFactory.create(AppModule, {
44
+ * adapter: defineFastifyEnvironment(),
45
+ * })
46
+ *
47
+ * app.usePlugin(defineOpenApiPlugin({
48
+ * info: {
49
+ * title: 'My API',
50
+ * version: '1.0.0',
51
+ * description: 'API documentation',
52
+ * },
53
+ * servers: [
54
+ * { url: 'http://localhost:3000', description: 'Development' },
55
+ * ],
56
+ * securitySchemes: {
57
+ * bearerAuth: {
58
+ * type: 'http',
59
+ * scheme: 'bearer',
60
+ * bearerFormat: 'JWT',
61
+ * },
62
+ * },
63
+ * scalar: {
64
+ * theme: 'purple',
65
+ * },
66
+ * }))
67
+ *
68
+ * await app.listen({ port: 3000 })
69
+ * // API docs available at http://localhost:3000/docs
70
+ * ```
71
+ */
72
+ export declare function defineOpenApiPlugin(options: FastifyOpenApiPluginOptions): PluginDefinition<FastifyOpenApiPluginOptions>;
73
+ export type { ScalarOptions, ScalarTheme };
74
+ //# sourceMappingURL=openapi-fastify.plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-fastify.plugin.d.mts","sourceRoot":"","sources":["../../src/openapi-fastify.plugin.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,aAAa,EACb,gBAAgB,EACjB,MAAM,cAAc,CAAA;AACrB,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAQ9D,OAAO,KAAK,EACV,+BAA+B,EAC/B,aAAa,EACb,WAAW,EACZ,MAAM,qBAAqB,CAAA;AAK5B;;;GAGG;AACH,MAAM,WAAW,2BACf,SAAQ,uBAAuB,EAAE,OAAO,CAAC,+BAA+B,CAAC;CAAG;AAE9E;;;;;;;;GAQG;AACH,qBAAa,oBAAqB,YAAW,YAAY,CAAC,2BAA2B,CAAC;IACpF,QAAQ,CAAC,IAAI,qBAAoB;IAE3B,QAAQ,CACZ,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC;IAiDhB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;CAa3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,2BAA2B,GACnC,gBAAgB,CAAC,2BAA2B,CAAC,CAK/C;AAGD,YAAY,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { fastifyOpenApiPluginOptionsSchema, scalarMetaDataSchema, scalarOptionsSchema, scalarThemeSchema, type FastifyOpenApiPluginOptionsBase, type ScalarMetaData, type ScalarOptions, type ScalarTheme, } from './openapi-fastify-options.schema.mjs';
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/schemas/index.mts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,KAAK,+BAA+B,EACpC,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,WAAW,GACjB,MAAM,sCAAsC,CAAA"}
@@ -0,0 +1,113 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * Zod schema for Scalar UI theme options
4
+ */
5
+ export declare const scalarThemeSchema: z.ZodEnum<{
6
+ default: "default";
7
+ alternate: "alternate";
8
+ moon: "moon";
9
+ purple: "purple";
10
+ solarized: "solarized";
11
+ bluePlanet: "bluePlanet";
12
+ saturn: "saturn";
13
+ kepler: "kepler";
14
+ mars: "mars";
15
+ deepSpace: "deepSpace";
16
+ laserwave: "laserwave";
17
+ elysiajs: "elysiajs";
18
+ fastify: "fastify";
19
+ none: "none";
20
+ }>;
21
+ /**
22
+ * Zod schema for Scalar UI metadata
23
+ */
24
+ export declare const scalarMetaDataSchema: z.ZodOptional<z.ZodObject<{
25
+ title: z.ZodOptional<z.ZodString>;
26
+ description: z.ZodOptional<z.ZodString>;
27
+ ogDescription: z.ZodOptional<z.ZodString>;
28
+ ogTitle: z.ZodOptional<z.ZodString>;
29
+ ogImage: z.ZodOptional<z.ZodString>;
30
+ twitterCard: z.ZodOptional<z.ZodString>;
31
+ }, z.core.$strip>>;
32
+ /**
33
+ * Zod schema for Scalar UI configuration options
34
+ */
35
+ export declare const scalarOptionsSchema: z.ZodObject<{
36
+ theme: z.ZodOptional<z.ZodEnum<{
37
+ default: "default";
38
+ alternate: "alternate";
39
+ moon: "moon";
40
+ purple: "purple";
41
+ solarized: "solarized";
42
+ bluePlanet: "bluePlanet";
43
+ saturn: "saturn";
44
+ kepler: "kepler";
45
+ mars: "mars";
46
+ deepSpace: "deepSpace";
47
+ laserwave: "laserwave";
48
+ elysiajs: "elysiajs";
49
+ fastify: "fastify";
50
+ none: "none";
51
+ }>>;
52
+ favicon: z.ZodOptional<z.ZodString>;
53
+ logo: z.ZodOptional<z.ZodString>;
54
+ hideDownloadButton: z.ZodOptional<z.ZodBoolean>;
55
+ hideSearch: z.ZodOptional<z.ZodBoolean>;
56
+ customCss: z.ZodOptional<z.ZodString>;
57
+ metaData: z.ZodOptional<z.ZodObject<{
58
+ title: z.ZodOptional<z.ZodString>;
59
+ description: z.ZodOptional<z.ZodString>;
60
+ ogDescription: z.ZodOptional<z.ZodString>;
61
+ ogTitle: z.ZodOptional<z.ZodString>;
62
+ ogImage: z.ZodOptional<z.ZodString>;
63
+ twitterCard: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strip>>;
65
+ cdn: z.ZodOptional<z.ZodString>;
66
+ }, z.core.$strip>;
67
+ /**
68
+ * Zod schema for Fastify OpenAPI plugin options
69
+ */
70
+ export declare const fastifyOpenApiPluginOptionsSchema: z.ZodObject<{
71
+ jsonPath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
72
+ yamlPath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
73
+ docsPath: z.ZodDefault<z.ZodOptional<z.ZodString>>;
74
+ scalar: z.ZodOptional<z.ZodObject<{
75
+ theme: z.ZodOptional<z.ZodEnum<{
76
+ default: "default";
77
+ alternate: "alternate";
78
+ moon: "moon";
79
+ purple: "purple";
80
+ solarized: "solarized";
81
+ bluePlanet: "bluePlanet";
82
+ saturn: "saturn";
83
+ kepler: "kepler";
84
+ mars: "mars";
85
+ deepSpace: "deepSpace";
86
+ laserwave: "laserwave";
87
+ elysiajs: "elysiajs";
88
+ fastify: "fastify";
89
+ none: "none";
90
+ }>>;
91
+ favicon: z.ZodOptional<z.ZodString>;
92
+ logo: z.ZodOptional<z.ZodString>;
93
+ hideDownloadButton: z.ZodOptional<z.ZodBoolean>;
94
+ hideSearch: z.ZodOptional<z.ZodBoolean>;
95
+ customCss: z.ZodOptional<z.ZodString>;
96
+ metaData: z.ZodOptional<z.ZodObject<{
97
+ title: z.ZodOptional<z.ZodString>;
98
+ description: z.ZodOptional<z.ZodString>;
99
+ ogDescription: z.ZodOptional<z.ZodString>;
100
+ ogTitle: z.ZodOptional<z.ZodString>;
101
+ ogImage: z.ZodOptional<z.ZodString>;
102
+ twitterCard: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>>;
104
+ cdn: z.ZodOptional<z.ZodString>;
105
+ }, z.core.$strip>>;
106
+ disableScalar: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
107
+ disableYaml: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
108
+ }, z.core.$strip>;
109
+ export type ScalarTheme = z.infer<typeof scalarThemeSchema>;
110
+ export type ScalarMetaData = z.infer<typeof scalarMetaDataSchema>;
111
+ export type ScalarOptions = z.infer<typeof scalarOptionsSchema>;
112
+ export type FastifyOpenApiPluginOptionsBase = z.infer<typeof fastifyOpenApiPluginOptionsSchema>;
113
+ //# sourceMappingURL=openapi-fastify-options.schema.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi-fastify-options.schema.d.mts","sourceRoot":"","sources":["../../../src/schemas/openapi-fastify-options.schema.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;EAe5B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;;;;kBASpB,CAAA;AAEb;;GAEG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4C9B,CAAA;AAEF;;GAEG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAmC5C,CAAA;AAEF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAA;AAC3D,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AACjE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAC/D,MAAM,MAAM,+BAA+B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iCAAiC,CAAC,CAAA"}
@@ -0,0 +1,26 @@
1
+ import type { OpenApiGeneratorOptions } from '@navios/openapi';
2
+ /**
3
+ * OpenAPI document shape (minimal interface for typing)
4
+ */
5
+ export interface OpenAPIDocument {
6
+ openapi: string;
7
+ info: {
8
+ title: string;
9
+ version: string;
10
+ };
11
+ paths?: Record<string, unknown>;
12
+ servers?: Array<{
13
+ url: string;
14
+ description?: string;
15
+ }>;
16
+ }
17
+ /**
18
+ * Applies global prefix to OpenAPI servers if needed.
19
+ *
20
+ * @param document - The OpenAPI document to modify
21
+ * @param globalPrefix - The global route prefix (e.g., '/api/v1')
22
+ * @param options - Plugin options that may contain server configuration
23
+ * @returns The document with servers array updated if applicable
24
+ */
25
+ export declare function applyGlobalPrefix<T extends OpenAPIDocument>(document: T, globalPrefix: string, options: OpenApiGeneratorOptions): T;
26
+ //# sourceMappingURL=apply-global-prefix.util.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-global-prefix.util.d.mts","sourceRoot":"","sources":["../../../src/utils/apply-global-prefix.util.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAA;AAE9D;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,MAAM,CAAA;KAChB,CAAA;IACD,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,GAAG,EAAE,MAAM,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,CAAA;KACrB,CAAC,CAAA;CACH;AAED;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,eAAe,EACzD,QAAQ,EAAE,CAAC,EACX,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,uBAAuB,GAC/B,CAAC,CAqBH"}
@@ -0,0 +1,2 @@
1
+ export { applyGlobalPrefix, type OpenAPIDocument } from './apply-global-prefix.util.mjs';
2
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/utils/index.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,KAAK,eAAe,EAAE,MAAM,gCAAgC,CAAA"}