@accordproject/concerto-cto 1.2.2-20220111153301 → 1.2.2-20220113193236
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/index.js +1 -1
- package/lib/printer.js +10 -6
- package/package.json +1 -1
package/index.js
CHANGED
package/lib/printer.js
CHANGED
|
@@ -157,11 +157,11 @@ function propertyFromMetaModel(mm) {
|
|
|
157
157
|
result += '[]';
|
|
158
158
|
}
|
|
159
159
|
result += ` ${mm.name}`;
|
|
160
|
+
result += defaultString;
|
|
161
|
+
result += validatorString;
|
|
160
162
|
if (mm.isOptional) {
|
|
161
163
|
result += ' optional';
|
|
162
164
|
}
|
|
163
|
-
result += defaultString;
|
|
164
|
-
result += validatorString;
|
|
165
165
|
return result;
|
|
166
166
|
}
|
|
167
167
|
|
|
@@ -199,10 +199,6 @@ function declFromMetaModel(mm) {
|
|
|
199
199
|
result += `enum ${mm.name} `;
|
|
200
200
|
break;
|
|
201
201
|
}
|
|
202
|
-
if (mm.superType) {
|
|
203
|
-
result += `extends ${mm.superType.name} `;
|
|
204
|
-
}
|
|
205
|
-
// XXX Needs to be fixed to support `identified`
|
|
206
202
|
if (mm.identified) {
|
|
207
203
|
if (mm.identified.$class === 'concerto.metamodel.IdentifiedBy') {
|
|
208
204
|
result += `identified by ${mm.identified.name} `;
|
|
@@ -210,6 +206,9 @@ function declFromMetaModel(mm) {
|
|
|
210
206
|
result += 'identified ';
|
|
211
207
|
}
|
|
212
208
|
}
|
|
209
|
+
if (mm.superType) {
|
|
210
|
+
result += `extends ${mm.superType.name} `;
|
|
211
|
+
}
|
|
213
212
|
result += '{';
|
|
214
213
|
mm.properties.forEach((property) => {
|
|
215
214
|
result += `\n ${propertyFromMetaModel(property)}`;
|
|
@@ -225,6 +224,11 @@ function declFromMetaModel(mm) {
|
|
|
225
224
|
*/
|
|
226
225
|
function toCTO(metaModel) {
|
|
227
226
|
let result = '';
|
|
227
|
+
if (metaModel.concertoVersion) {
|
|
228
|
+
result += `concerto version "${metaModel.concertoVersion}"`;
|
|
229
|
+
result += '\n';
|
|
230
|
+
result += '\n';
|
|
231
|
+
}
|
|
228
232
|
result += `namespace ${metaModel.namespace}`;
|
|
229
233
|
if (metaModel.imports && metaModel.imports.length > 0) {
|
|
230
234
|
result += '\n';
|
package/package.json
CHANGED