@sdk-it/typescript 0.46.1 → 0.46.3
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.js +3 -0
- package/dist/index.js.map +2 -2
- package/dist/lib/emitters/zod.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -356,6 +356,9 @@ var ZodEmitter = class {
|
|
|
356
356
|
if (schema.oneOf && Array.isArray(schema.oneOf) && schema.oneOf.length) {
|
|
357
357
|
return this.oneOf(schema.oneOf ?? [], required);
|
|
358
358
|
}
|
|
359
|
+
if (schema.const !== void 0) {
|
|
360
|
+
return `z.literal(${JSON.stringify(schema.const)})${this.#suffixes(JSON.stringify(schema.default), required, false)}`;
|
|
361
|
+
}
|
|
359
362
|
if (schema.enum && Array.isArray(schema.enum)) {
|
|
360
363
|
const enumVals = schema.enum.map((val) => JSON.stringify(val));
|
|
361
364
|
const defaultValue = enumVals.includes(JSON.stringify(schema.default)) ? JSON.stringify(schema.default) : void 0;
|