@kubb/swagger-ts 1.1.0 → 1.1.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 CHANGED
@@ -10,13 +10,13 @@
10
10
  <!-- Badges -->
11
11
  <p>
12
12
  <a href="https://www.npmjs.com/package/@kubb/swagger-ts">
13
- <img alt="Npm version" src="https://img.shields.io/npm/v/@kubb/swagger-ts?style=for-the-badge"/>
13
+ <img alt="npm version" src="https://img.shields.io/npm/v/@kubb/swagger-ts?style=for-the-badge"/>
14
14
  </a>
15
15
  <a href="https://www.npmjs.com/package/@kubb/swagger-ts">
16
- <img alt="Npm downloads" src="https://img.shields.io/bundlephobia/min/@kubb/swagger-ts?style=for-the-badge"/>
16
+ <img alt="npm downloads" src="https://img.shields.io/bundlephobia/min/@kubb/swagger-ts?style=for-the-badge"/>
17
17
  </a>
18
18
  <a href="https://www.npmjs.com/package/@kubb/swagger-ts">
19
- <img alt="Npm downloads" src="https://img.shields.io/npm/dm/@kubb/swagger-ts?style=for-the-badge"/>
19
+ <img alt="npm downloads" src="https://img.shields.io/npm/dm/@kubb/swagger-ts?style=for-the-badge"/>
20
20
  </a>
21
21
  </p>
22
22
 
package/dist/index.cjs CHANGED
@@ -120,7 +120,9 @@ var _TypeGenerator = class extends core.SchemaGenerator {
120
120
  comments: [
121
121
  schema.description && `@description ${schema.description}`,
122
122
  schema.type && `@type ${schema.type}${isRequired ? "" : " | undefined"} ${schema.format || ""}`,
123
- schema.example && `@example ${schema.example}`
123
+ schema.example && `@example ${schema.example}`,
124
+ schema.default !== void 0 && typeof schema.default === "string" && `@default '${schema.default}'`,
125
+ schema.default !== void 0 && typeof schema.default !== "string" && `@default ${schema.default}`
124
126
  ]
125
127
  });
126
128
  }
package/dist/index.js CHANGED
@@ -110,7 +110,9 @@ var _TypeGenerator = class extends SchemaGenerator {
110
110
  comments: [
111
111
  schema.description && `@description ${schema.description}`,
112
112
  schema.type && `@type ${schema.type}${isRequired ? "" : " | undefined"} ${schema.format || ""}`,
113
- schema.example && `@example ${schema.example}`
113
+ schema.example && `@example ${schema.example}`,
114
+ schema.default !== void 0 && typeof schema.default === "string" && `@default '${schema.default}'`,
115
+ schema.default !== void 0 && typeof schema.default !== "string" && `@default ${schema.default}`
114
116
  ]
115
117
  });
116
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/swagger-ts",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Generator swagger-ts",
5
5
  "repository": {
6
6
  "type": "git",
@@ -41,9 +41,9 @@
41
41
  "change-case": "^4.1.2",
42
42
  "lodash.uniqueid": "^4.0.1",
43
43
  "typescript": "^5.1.3",
44
- "@kubb/core": "1.1.0",
45
- "@kubb/swagger": "1.1.0",
46
- "@kubb/ts-codegen": "1.1.0"
44
+ "@kubb/core": "1.1.1",
45
+ "@kubb/swagger": "1.1.1",
46
+ "@kubb/ts-codegen": "1.1.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/lodash.uniqueid": "^4.0.7",
@@ -138,6 +138,8 @@ export class TypeGenerator extends SchemaGenerator<Options, OpenAPIV3.SchemaObje
138
138
  schema.description && `@description ${schema.description}`,
139
139
  schema.type && `@type ${schema.type}${isRequired ? '' : ' | undefined'} ${schema.format || ''}`,
140
140
  schema.example && `@example ${schema.example}`,
141
+ schema.default !== undefined && typeof schema.default === 'string' && `@default '${schema.default}'`,
142
+ schema.default !== undefined && typeof schema.default !== 'string' && `@default ${schema.default}`,
141
143
  ],
142
144
  })
143
145
  }
package/src/plugin.ts CHANGED
@@ -8,7 +8,7 @@ import { pascalCase, pascalCaseTransformMerge } from 'change-case'
8
8
 
9
9
  import { getRelativePath, createPlugin, getPathMode, validatePlugins, writeIndexes, renderTemplate } from '@kubb/core'
10
10
  import { pluginName as swaggerPluginName } from '@kubb/swagger'
11
- import type { Api as SwaggerApi, OpenAPIV3 } from '@kubb/swagger'
11
+ import type { API as SwaggerApi, OpenAPIV3 } from '@kubb/swagger'
12
12
 
13
13
  import { TypeBuilder } from './builders/index.ts'
14
14
  import { OperationGenerator } from './generators/index.ts'