File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed
templates/cli/lib/type-generation/languages Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -12,10 +12,12 @@ class JavaScript extends LanguageMeta {
12
12
case AttributeType.STRING:
13
13
case AttributeType.EMAIL:
14
14
case AttributeType.DATETIME:
15
- case AttributeType.ENUM:
16
15
case AttributeType.IP:
17
16
case AttributeType.___URL:
18
17
type = "string";
18
+ if (attribute.format === AttributeType.ENUM) {
19
+ type = `"${attribute.elements.join('"|"')}"`;
20
+ }
19
21
break;
20
22
case AttributeType.INTEGER:
21
23
type = "number";
Original file line number Diff line number Diff line change @@ -9,8 +9,10 @@ class Kotlin extends LanguageMeta {
9
9
case AttributeType.STRING:
10
10
case AttributeType.EMAIL:
11
11
case AttributeType.DATETIME:
12
- case AttributeType.ENUM:
13
12
type = "String";
13
+ if (attribute.format === AttributeType.ENUM) {
14
+ type = LanguageMeta.toPascalCase(attribute.key);
15
+ }
14
16
break;
15
17
case AttributeType.INTEGER:
16
18
type = "Int";
@@ -46,6 +48,16 @@ class Kotlin extends LanguageMeta {
46
48
<% if (attribute.type === ' relationship' ) { -%>
47
49
import <% - toPascalCase(attribute.relatedCollection) %>
48
50
51
+ <% } -%>
52
+ <% } -%>
53
+ <% for (const attribute of collection.attributes) { -%>
54
+ <% if (attribute.format === ' enum' ) { -%>
55
+ enum class <% - toPascalCase(attribute.key) %> {
56
+ <% for (const [index, element] of Object .entries(attribute.elements)) { -%>
57
+ <% - element %><% - index < attribute.elements.length - 1 ? ' ,' : ' ' %>
58
+ <% } -%>
59
+ }
60
+
49
61
<% } -%>
50
62
<% } -%>
51
63
data class <% - toPascalCase(collection.name) %> (
You can’t perform that action at this time.
0 commit comments