Skip to content

Commit 3cf151d

Browse files
committed
Revert "Revert "Revert "feat: fixed data tags, description preset for Go, add goIncludeComments and goIncludeTags flags (#2123)"""
This reverts commit 17c25ab.
1 parent 17c25ab commit 3cf151d

File tree

3 files changed

+8
-28
lines changed

3 files changed

+8
-28
lines changed

modelina-cli/.eslintignore

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/lib
22
/tmp
33
/scripts
4-
/test/helpers/init.js
5-
/test/fixtures/generate
4+
/test/helpers/init.js

modelina-cli/src/commands/generate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ export default class Models extends ModelinaCommand {
1414
try {
1515
document = await readFile(file, 'utf8');
1616
} catch {
17-
throw new Error(`Unable to read input file content: ${file}`);
17+
throw new Error('Unable to read input file content.');
1818
}
19-
19+
2020
const logger = {
2121
info: (message: string) => {
2222
this.log(message);

modelina-cli/src/helpers/go.ts

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
1-
import { GO_DESCRIPTION_PRESET, GO_COMMON_PRESET, GoCommonPresetOptions, GoFileGenerator } from "@asyncapi/modelina";
1+
import { GoFileGenerator } from "@asyncapi/modelina";
22
import { BuilderReturnType } from "./generate";
3-
import { Flags } from "@oclif/core";
43

5-
export const GoOclifFlags = {
6-
goIncludeComments: Flags.boolean({
7-
description: 'Golang specific, if enabled add comments while generating models.',
8-
required: false,
9-
default: false,
10-
}),
11-
goIncludeTags: Flags.boolean({
12-
description: 'Golang specific, if enabled add tags while generating models.',
13-
required: false,
14-
default: false,
15-
}),
16-
}
4+
export const GoOclifFlags = { }
175

186
/**
197
* This function builds all the relevant information for the main generate command
@@ -22,20 +10,13 @@ export const GoOclifFlags = {
2210
* @returns
2311
*/
2412
export function buildGoGenerator(flags: any): BuilderReturnType {
25-
const { packageName, goIncludeComments, goIncludeTags } = flags;
26-
13+
const { packageName } = flags;
14+
2715
if (packageName === undefined) {
2816
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.');
2917
}
3018

31-
const presets = []
32-
if (goIncludeTags) {
33-
const options: GoCommonPresetOptions = { addJsonTag: true };
34-
presets.push({ preset: GO_COMMON_PRESET, options })
35-
}
36-
37-
if (goIncludeComments) { presets.push(GO_DESCRIPTION_PRESET); }
38-
const fileGenerator = new GoFileGenerator({ presets });
19+
const fileGenerator = new GoFileGenerator();
3920
const fileOptions = {
4021
packageName
4122
};

0 commit comments

Comments
 (0)