diff --git a/hooks/00_generateModel.js b/hooks/00_generateModel.js new file mode 100644 index 000000000..7d5cfee6a --- /dev/null +++ b/hooks/00_generateModel.js @@ -0,0 +1,23 @@ +const fs= require('fs'); +const modelina = require('@asyncapi/modelina') +const path = require("path"); + +module.exports = { + 'generate:before': generator => { + const javaGenerator = new modelina.JavaFileGenerator(); + + javaGenerator.generateToFiles(generator.asyncapi, path.resolve(generator.targetDir, 'src/main/java/com/asyncapi/modelina/'), { + collectionType: "List", + presets: [ + { + preset: modelina.JAVA_COMMON_PRESET, + options: { + equal: true, + hashCode: true, + classToString: true + } + } + ] + }, true) + } +}; \ No newline at end of file diff --git a/package.json b/package.json index 207e05b28..496381228 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,8 @@ "fs-extra": "^9.0.0", "lodash": "^4.17.21", "replace-in-file": "^6.1.0", - "tmp": "^0.2.1" + "tmp": "^0.2.1", + "@asyncapi/modelina": "^1.9.0" }, "devDependencies": { "@asyncapi/generator": "^1.14.0",