@goast/kotlin 0.1.8 → 0.1.9
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.
|
@@ -420,18 +420,18 @@ class DefaultKotlinModelGenerator extends file_generator_1.KotlinFileGenerator {
|
|
|
420
420
|
.filter((item, index, self) => self.indexOf(item) === index);
|
|
421
421
|
}
|
|
422
422
|
classifyClassProperties(ctx, schema) {
|
|
423
|
-
var _a
|
|
423
|
+
var _a;
|
|
424
424
|
const inheritedSchemas = this.getInheritedSchemas(ctx, schema);
|
|
425
425
|
const result = { params: [], properties: [] };
|
|
426
426
|
for (const property of schema.properties.values()) {
|
|
427
427
|
const discriminator = (_a = inheritedSchemas.find((x) => { var _a; return ((_a = x.discriminator) === null || _a === void 0 ? void 0 : _a.propertyName) === property.name; })) === null || _a === void 0 ? void 0 : _a.discriminator;
|
|
428
428
|
if (discriminator) {
|
|
429
|
-
const
|
|
430
|
-
if (
|
|
429
|
+
const schemaMappings = Object.entries(discriminator.mapping).filter(([_, v]) => v.id === schema.id);
|
|
430
|
+
if (schemaMappings.length === 1) {
|
|
431
431
|
const p = (0, core_1.createOverwriteProxy)(property);
|
|
432
432
|
const s = (0, core_1.createOverwriteProxy)(p.schema);
|
|
433
433
|
p.schema = s;
|
|
434
|
-
s.default =
|
|
434
|
+
s.default = schemaMappings[0][0];
|
|
435
435
|
result.properties.push(p);
|
|
436
436
|
continue;
|
|
437
437
|
}
|
|
@@ -417,18 +417,18 @@ export class DefaultKotlinModelGenerator extends KotlinFileGenerator {
|
|
|
417
417
|
.filter((item, index, self) => self.indexOf(item) === index);
|
|
418
418
|
}
|
|
419
419
|
classifyClassProperties(ctx, schema) {
|
|
420
|
-
var _a
|
|
420
|
+
var _a;
|
|
421
421
|
const inheritedSchemas = this.getInheritedSchemas(ctx, schema);
|
|
422
422
|
const result = { params: [], properties: [] };
|
|
423
423
|
for (const property of schema.properties.values()) {
|
|
424
424
|
const discriminator = (_a = inheritedSchemas.find((x) => { var _a; return ((_a = x.discriminator) === null || _a === void 0 ? void 0 : _a.propertyName) === property.name; })) === null || _a === void 0 ? void 0 : _a.discriminator;
|
|
425
425
|
if (discriminator) {
|
|
426
|
-
const
|
|
427
|
-
if (
|
|
426
|
+
const schemaMappings = Object.entries(discriminator.mapping).filter(([_, v]) => v.id === schema.id);
|
|
427
|
+
if (schemaMappings.length === 1) {
|
|
428
428
|
const p = createOverwriteProxy(property);
|
|
429
429
|
const s = createOverwriteProxy(p.schema);
|
|
430
430
|
p.schema = s;
|
|
431
|
-
s.default =
|
|
431
|
+
s.default = schemaMappings[0][0];
|
|
432
432
|
result.properties.push(p);
|
|
433
433
|
continue;
|
|
434
434
|
}
|