@tim-smart/openapi-gen 0.3.4 → 0.3.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/main.js +4 -7
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -29456,12 +29456,6 @@ var make65 = gen2(function* () {
|
|
|
29456
29456
|
const isEnum = enums.has(name);
|
|
29457
29457
|
return toSource(S, schema, name, isClass || isEnum).pipe(
|
|
29458
29458
|
map((source) => {
|
|
29459
|
-
if (name === "Model") {
|
|
29460
|
-
console.error({
|
|
29461
|
-
name,
|
|
29462
|
-
source
|
|
29463
|
-
});
|
|
29464
|
-
}
|
|
29465
29459
|
const isObject2 = "properties" in schema;
|
|
29466
29460
|
if (!isObject2 || !isClass) {
|
|
29467
29461
|
return `export class ${name} extends ${source} {}`;
|
|
@@ -29483,7 +29477,7 @@ var make65 = gen2(function* () {
|
|
|
29483
29477
|
map(
|
|
29484
29478
|
applyAnnotations(S, {
|
|
29485
29479
|
isOptional,
|
|
29486
|
-
isNullable: "nullable" in fullSchema && fullSchema.nullable === true,
|
|
29480
|
+
isNullable: "nullable" in fullSchema && fullSchema.nullable === true || "default" in fullSchema && fullSchema.default === null,
|
|
29487
29481
|
default: fullSchema.default
|
|
29488
29482
|
})
|
|
29489
29483
|
),
|
|
@@ -29607,6 +29601,9 @@ var make65 = gen2(function* () {
|
|
|
29607
29601
|
return none2();
|
|
29608
29602
|
};
|
|
29609
29603
|
const applyAnnotations = (S, options3) => (source) => {
|
|
29604
|
+
if (options3.isNullable && options3.default === null) {
|
|
29605
|
+
return `${S}.optionalWith(${S}.NullOr(${source}), { default: () => null })`;
|
|
29606
|
+
}
|
|
29610
29607
|
const defaultSource = options3.default !== void 0 && options3.default !== null ? `() => ${JSON.stringify(options3.default)} as const` : void 0;
|
|
29611
29608
|
if (options3.isOptional) {
|
|
29612
29609
|
return defaultSource ? `${S}.optionalWith(${source}, { nullable: true, default: ${defaultSource} })` : `${S}.optionalWith(${source}, { nullable: true })`;
|