@kubb/swagger-ts 2.0.0-beta.4 → 2.0.0-beta.6

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
@@ -83,9 +83,9 @@ var __privateMethod = (obj, member, method) => {
83
83
  return method;
84
84
  };
85
85
 
86
- // ../../node_modules/.pnpm/tsup@8.0.1_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/cjs_shims.js
86
+ // ../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/cjs_shims.js
87
87
  var init_cjs_shims = __esm({
88
- "../../node_modules/.pnpm/tsup@8.0.1_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/cjs_shims.js"() {
88
+ "../../node_modules/.pnpm/tsup@8.0.1_@microsoft+api-extractor@7.38.3_ts-node@10.9.1_typescript@5.3.2/node_modules/tsup/assets/cjs_shims.js"() {
89
89
  }
90
90
  });
91
91
 
@@ -3449,6 +3449,17 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
3449
3449
  if (schema.properties || schema.additionalProperties) {
3450
3450
  return __privateMethod(this, _getTypeFromProperties, getTypeFromProperties_fn).call(this, schema, baseName);
3451
3451
  }
3452
+ if (version === "3.1" && "const" in schema) {
3453
+ if (schema["const"]) {
3454
+ if (typeof schema["const"] === "string") {
3455
+ return factory__namespace.createLiteralTypeNode(factory__namespace.createStringLiteral(schema["const"]));
3456
+ } else if (typeof schema["const"] === "number") {
3457
+ return factory__namespace.createLiteralTypeNode(factory__namespace.createNumericLiteral(schema["const"]));
3458
+ }
3459
+ } else {
3460
+ return factory.keywordTypeNodes.null;
3461
+ }
3462
+ }
3452
3463
  if (schema.type) {
3453
3464
  if (Array.isArray(schema.type)) {
3454
3465
  const [type, nullable] = schema.type;
@@ -3475,9 +3486,6 @@ getBaseTypeFromSchema_fn = function(_schema, baseName) {
3475
3486
  if (schema.format === "binary") {
3476
3487
  return factory__namespace.createTypeReferenceNode("Blob", []);
3477
3488
  }
3478
- if (version === "3.1" && typeof schema["const"] === "string") {
3479
- return factory__namespace.createLiteralTypeNode(factory__namespace.createStringLiteral(schema["const"]));
3480
- }
3481
3489
  return factory__namespace.keywordTypeNodes.any;
3482
3490
  };
3483
3491