diff --git a/modelina-cli/.eslintignore b/modelina-cli/.eslintignore index 0430133d29..06a195ae67 100644 --- a/modelina-cli/.eslintignore +++ b/modelina-cli/.eslintignore @@ -1,5 +1,4 @@ /lib /tmp /scripts -/test/helpers/init.js -/test/fixtures/generate \ No newline at end of file +/test/helpers/init.js \ No newline at end of file diff --git a/modelina-cli/src/commands/generate.ts b/modelina-cli/src/commands/generate.ts index 0091dd2f39..3117df74d4 100644 --- a/modelina-cli/src/commands/generate.ts +++ b/modelina-cli/src/commands/generate.ts @@ -14,9 +14,9 @@ export default class Models extends ModelinaCommand { try { document = await readFile(file, 'utf8'); } catch { - throw new Error(`Unable to read input file content: ${file}`); + throw new Error('Unable to read input file content.'); } - + const logger = { info: (message: string) => { this.log(message); diff --git a/modelina-cli/src/helpers/go.ts b/modelina-cli/src/helpers/go.ts index ac09dce990..ffd3a58d91 100644 --- a/modelina-cli/src/helpers/go.ts +++ b/modelina-cli/src/helpers/go.ts @@ -1,19 +1,7 @@ -import { GO_DESCRIPTION_PRESET, GO_COMMON_PRESET, GoCommonPresetOptions, GoFileGenerator } from "@asyncapi/modelina"; +import { GoFileGenerator } from "@asyncapi/modelina"; import { BuilderReturnType } from "./generate"; -import { Flags } from "@oclif/core"; -export const GoOclifFlags = { - goIncludeComments: Flags.boolean({ - description: 'Golang specific, if enabled add comments while generating models.', - required: false, - default: false, - }), - goIncludeTags: Flags.boolean({ - description: 'Golang specific, if enabled add tags while generating models.', - required: false, - default: false, - }), -} +export const GoOclifFlags = { } /** * This function builds all the relevant information for the main generate command @@ -22,20 +10,13 @@ export const GoOclifFlags = { * @returns */ export function buildGoGenerator(flags: any): BuilderReturnType { - const { packageName, goIncludeComments, goIncludeTags } = flags; - + const { packageName } = flags; + if (packageName === undefined) { throw new Error('In order to generate models to Go, we need to know which package they are under. Add `--packageName=PACKAGENAME` to set the desired package name.'); } - const presets = [] - if (goIncludeTags) { - const options: GoCommonPresetOptions = { addJsonTag: true }; - presets.push({ preset: GO_COMMON_PRESET, options }) - } - - if (goIncludeComments) { presets.push(GO_DESCRIPTION_PRESET); } - const fileGenerator = new GoFileGenerator({ presets }); + const fileGenerator = new GoFileGenerator(); const fileOptions = { packageName };