@sebspark/openapi-typegen 1.10.0 → 2.0.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 (2) hide show
  1. package/dist/index.js +8 -0
  2. package/package.json +5 -7
package/dist/index.js CHANGED
@@ -268,6 +268,14 @@ var generateArray = (parsed) => {
268
268
  return lines.join("\n");
269
269
  };
270
270
  var generateEnum = (parsed) => {
271
+ if (parsed.name) {
272
+ const values = parsed.values.map(serializeValue).join(", ");
273
+ const valuesName = (0, import_change_case.constantCase)(`${parsed.name}_VALUES`);
274
+ return [
275
+ `export const ${valuesName} = [${values}] as const`,
276
+ `${preamble(parsed)}typeof ${valuesName}[number]`
277
+ ].join("\n");
278
+ }
271
279
  return `${preamble(parsed)}${parsed.values.map(serializeValue).join(OR)}`;
272
280
  };
273
281
  var generateHeader = (header) => {
package/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@sebspark/openapi-typegen",
3
- "version": "1.10.0",
3
+ "version": "2.0.0",
4
4
  "license": "Apache-2.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "bin": {
8
- "openapi-typegen": "./cli.mjs"
9
- },
7
+ "bin": "./cli.mjs",
10
8
  "files": [
11
9
  "dist",
12
10
  "cli.mjs"
@@ -19,7 +17,7 @@
19
17
  "typecheck": "vitest --typecheck.only --passWithNoTests"
20
18
  },
21
19
  "devDependencies": {
22
- "@types/yargs": "17.0.32",
20
+ "@types/yargs": "17.0.33",
23
21
  "tsconfig": "*"
24
22
  },
25
23
  "dependencies": {
@@ -27,8 +25,8 @@
27
25
  "boxen": "<6",
28
26
  "chalk": "<5",
29
27
  "change-case": "4.1.2",
30
- "prettier": "3.3.2",
31
- "yaml": "2.5.0",
28
+ "prettier": "3.4.2",
29
+ "yaml": "2.6.1",
32
30
  "yargs": "17.7.2"
33
31
  }
34
32
  }