@moostjs/swagger 0.3.42 → 0.3.43

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/dist/index.cjs CHANGED
@@ -323,6 +323,17 @@ function getSwaggerSchema(parsed, forParam) {
323
323
  return globalSchemas[zodType.__type_ref.name];
324
324
  }
325
325
  const schema = {};
326
+ if (meta) {
327
+ if (meta.swaggerExample) {
328
+ schema.example = meta.swaggerExample;
329
+ }
330
+ if (meta.label || meta.id) {
331
+ schema.title = meta.label || meta.id;
332
+ }
333
+ if (meta.description) {
334
+ schema.description = meta.description;
335
+ }
336
+ }
326
337
  if (!forParam && zodType.__type_ref) {
327
338
  globalSchemas[zodType.__type_ref.name] = schema;
328
339
  }
@@ -353,9 +364,6 @@ function getSwaggerSchema(parsed, forParam) {
353
364
  schema.enum = Object.keys(parsed.$value);
354
365
  }
355
366
  }
356
- if (meta?.swaggerExample) {
357
- schema.example = meta.swaggerExample;
358
- }
359
367
  if (forParam) {
360
368
  switch (parsed.$type) {
361
369
  case 'ZodAny':
package/dist/index.mjs CHANGED
@@ -321,6 +321,17 @@ function getSwaggerSchema(parsed, forParam) {
321
321
  return globalSchemas[zodType.__type_ref.name];
322
322
  }
323
323
  const schema = {};
324
+ if (meta) {
325
+ if (meta.swaggerExample) {
326
+ schema.example = meta.swaggerExample;
327
+ }
328
+ if (meta.label || meta.id) {
329
+ schema.title = meta.label || meta.id;
330
+ }
331
+ if (meta.description) {
332
+ schema.description = meta.description;
333
+ }
334
+ }
324
335
  if (!forParam && zodType.__type_ref) {
325
336
  globalSchemas[zodType.__type_ref.name] = schema;
326
337
  }
@@ -351,9 +362,6 @@ function getSwaggerSchema(parsed, forParam) {
351
362
  schema.enum = Object.keys(parsed.$value);
352
363
  }
353
364
  }
354
- if (meta?.swaggerExample) {
355
- schema.example = meta.swaggerExample;
356
- }
357
365
  if (forParam) {
358
366
  switch (parsed.$type) {
359
367
  case 'ZodAny':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moostjs/swagger",
3
- "version": "0.3.42",
3
+ "version": "0.3.43",
4
4
  "description": "@moostjs/swagger",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.cjs",
@@ -37,14 +37,14 @@
37
37
  },
38
38
  "homepage": "https://github.com/moostjs/moostjs/tree/main/packages/swagger#readme",
39
39
  "peerDependencies": {
40
- "moost": "0.3.42",
41
- "@moostjs/event-http": "0.3.42"
40
+ "moost": "0.3.43",
41
+ "@moostjs/event-http": "0.3.43"
42
42
  },
43
43
  "dependencies": {
44
44
  "@wooksjs/event-http": "^0.4.35",
45
45
  "swagger-ui-dist": "^5.10.5",
46
46
  "zod-parser": "^0.0.3",
47
- "@moostjs/zod": "0.3.42",
47
+ "@moostjs/zod": "0.3.43",
48
48
  "@wooksjs/http-static": "^0.4.35"
49
49
  },
50
50
  "devDependencies": {