Skip to content

Commit

Permalink
fix: add enum values to MySQL object of property decorator
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Aaqil <aaqilcs102@gmail.com>
  • Loading branch information
aaqilniz committed Jul 10, 2024
1 parent 7a1083e commit 7c8b374
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/cli/generators/discover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,16 @@ module.exports = class DiscoveryGenerator extends ArtifactGenerator {
enumValuesArray.forEach(item => {
enumItems += `'${item}',`;
});
const enumItemString = enumItems.toString().replace(/,\s*$/, '');
templateData.properties[key]['type'] = 'String';
templateData.properties[key]['tsType'] = 'string';
templateData.properties[key]['jsonSchema'] =
`{enum: [${enumItems.toString()}]}`;
`{enum: [${enumItemString}]}`;
const mysqlString = templateData.properties[key]['mysql'];
templateData.properties[key]['mysql'] = mysqlString.replace(
"'enum',",
`'enum', value: "${enumItemString}",`,
);
}
});
this.copyTemplatedFiles(
Expand Down

0 comments on commit 7c8b374

Please sign in to comment.