File tree Expand file tree Collapse file tree 7 files changed +21
-0
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 7 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ class Dart extends LanguageMeta {
62
62
break;
63
63
case AttributeType.RELATIONSHIP:
64
64
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
65
+ if (!relatedCollection) {
66
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
67
+ }
65
68
type = LanguageMeta.toPascalCase(relatedCollection.name);
66
69
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
67
70
type = `List< ${type}>`;
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Java extends LanguageMeta {
25
25
break;
26
26
case AttributeType.RELATIONSHIP:
27
27
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
28
+ if (!relatedCollection) {
29
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
30
+ }
28
31
type = LanguageMeta.toPascalCase(relatedCollection.name);
29
32
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
30
33
type = "List< " + type + ">";
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class JavaScript extends LanguageMeta {
30
30
break;
31
31
case AttributeType.RELATIONSHIP:
32
32
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
33
+ if (!relatedCollection) {
34
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
35
+ }
33
36
type = LanguageMeta.toPascalCase(relatedCollection.name);
34
37
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
35
38
type = `${type}[]`;
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Kotlin extends LanguageMeta {
25
25
break;
26
26
case AttributeType.RELATIONSHIP:
27
27
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
28
+ if (!relatedCollection) {
29
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
30
+ }
28
31
type = LanguageMeta.toPascalCase(relatedCollection.name);
29
32
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
30
33
type = `List< ${type}>`;
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class PHP extends LanguageMeta {
28
28
break;
29
29
case AttributeType.RELATIONSHIP:
30
30
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
31
+ if (!relatedCollection) {
32
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
33
+ }
31
34
type = LanguageMeta.toPascalCase(relatedCollection.name);
32
35
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
33
36
type = "array";
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Swift extends LanguageMeta {
25
25
break;
26
26
case AttributeType.RELATIONSHIP:
27
27
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
28
+ if (!relatedCollection) {
29
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
30
+ }
28
31
type = LanguageMeta.toPascalCase(relatedCollection.name);
29
32
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
30
33
type = `[${type}]`;
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class TypeScript extends LanguageMeta {
30
30
break;
31
31
case AttributeType.RELATIONSHIP:
32
32
const relatedCollection = collections.find(c => c.$id === attribute.relatedCollection);
33
+ if (!relatedCollection) {
34
+ throw new Error(`Related collection with ID '${attribute.relatedCollection}' not found.`);
35
+ }
33
36
type = LanguageMeta.toPascalCase(relatedCollection.name);
34
37
if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
35
38
type = `${type}[]`;
You can’t perform that action at this time.
0 commit comments