@extk/expressive 0.10.0 → 0.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.mjs +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -224,6 +224,17 @@ addRoute({
|
|
|
224
224
|
}, handler);
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
+
Pass `enabled: false` to skip swagger registration conditionally without breaking the chain:
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
.withSwagger(
|
|
231
|
+
b => b.withInfo({ title: 'My API', version: '1.0' }),
|
|
232
|
+
{ path: '/api-docs', enabled: isDev() },
|
|
233
|
+
)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
When `enabled` is `false`, `withSwagger` is a no-op and the chain continues normally. Omitting `enabled` (or passing `true`) keeps existing behavior.
|
|
237
|
+
|
|
227
238
|
Configure security schemes via the `configure` callback in `withSwagger`:
|
|
228
239
|
|
|
229
240
|
```ts
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -241,6 +241,7 @@ var ServerBuilder = class {
|
|
|
241
241
|
return this;
|
|
242
242
|
}
|
|
243
243
|
withSwagger(configure, opts, ...handlers) {
|
|
244
|
+
if (opts.enabled === false) return this;
|
|
244
245
|
const config = this.swaggerRef.doc;
|
|
245
246
|
if (!config) throw new Error("withSwagger must be called before build()");
|
|
246
247
|
configure(new SwaggerBuilder(config));
|
package/dist/index.mjs
CHANGED
|
@@ -180,6 +180,7 @@ var ServerBuilder = class {
|
|
|
180
180
|
return this;
|
|
181
181
|
}
|
|
182
182
|
withSwagger(configure, opts, ...handlers) {
|
|
183
|
+
if (opts.enabled === false) return this;
|
|
183
184
|
const config = this.swaggerRef.doc;
|
|
184
185
|
if (!config) throw new Error("withSwagger must be called before build()");
|
|
185
186
|
configure(new SwaggerBuilder(config));
|