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 {
6262 break;
6363 case AttributeType.RELATIONSHIP:
6464 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+ }
6568 type = LanguageMeta.toPascalCase(relatedCollection.name);
6669 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
6770 type = `List< ${type}>`;
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Java extends LanguageMeta {
2525 break;
2626 case AttributeType.RELATIONSHIP:
2727 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+ }
2831 type = LanguageMeta.toPascalCase(relatedCollection.name);
2932 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3033 type = "List< " + type + ">";
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class JavaScript extends LanguageMeta {
3030 break;
3131 case AttributeType.RELATIONSHIP:
3232 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+ }
3336 type = LanguageMeta.toPascalCase(relatedCollection.name);
3437 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3538 type = `${type}[]`;
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Kotlin extends LanguageMeta {
2525 break;
2626 case AttributeType.RELATIONSHIP:
2727 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+ }
2831 type = LanguageMeta.toPascalCase(relatedCollection.name);
2932 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3033 type = `List< ${type}>`;
Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ class PHP extends LanguageMeta {
2828 break;
2929 case AttributeType.RELATIONSHIP:
3030 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+ }
3134 type = LanguageMeta.toPascalCase(relatedCollection.name);
3235 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3336 type = "array";
Original file line number Diff line number Diff line change @@ -25,6 +25,9 @@ class Swift extends LanguageMeta {
2525 break;
2626 case AttributeType.RELATIONSHIP:
2727 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+ }
2831 type = LanguageMeta.toPascalCase(relatedCollection.name);
2932 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3033 type = `[${type}]`;
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ class TypeScript extends LanguageMeta {
3030 break;
3131 case AttributeType.RELATIONSHIP:
3232 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+ }
3336 type = LanguageMeta.toPascalCase(relatedCollection.name);
3437 if ((attribute.relationType === 'oneToMany' && attribute.side === 'parent') || (attribute.relationType === 'manyToOne' && attribute.side === 'child') || attribute.relationType === 'manyToMany') {
3538 type = `${type}[]`;
You can’t perform that action at this time.
0 commit comments