Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fixed data tags, description preset for Go, add goIncludeComments and goIncludeTags flags #2123

Open
wants to merge 7 commits into
base: next
Choose a base branch
from

Conversation

TertiumOrganum1
Copy link

Description

Anyway, I've managed to fix the Golang generator: I added comments from descriptions, enabled them in the Go helper, fixed the data tags by adding "required", added a flag to include comments in Go, and included the description preset in modelina-cli. I'm not sure why, but modelina-cli refused to accept the file parameter from the command line (even after packing it into a tarball), so I had to add an optional -i flag to specify the input path.

Related Issue

[FEATURE] Golang generator should include comments from parameter descriptions #2116

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint): yes, but two prettier issues are in conflict with default vscode ts formatter, so I left as is.
  • Tests have been added or updated to cover the changes: not yet
  • Documentation has been updated to reflect the changes: yes
  • All tests pass successfully locally.(npm run test): not yet

Additional Notes

I haven't been able to build the CLI correctly yet: it can't use the modelina library directly from the source (or via npm link). Therefore, I had to run npm run build:prod for modelina, copy its lib folder to the modelina-cli node_modules directory (after the initial npm install), and only then was I able to build modelina-cli and run it. Any advice on how to do this correctly would be appreciated. For now, I'll create a PR just for you to take a look.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

Copy link

netlify bot commented Nov 4, 2024

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit bae0c8c
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/672a243ce190f20008dda110

@jonaslagoni jonaslagoni changed the title feat golang: enabled and fixed data tags, added comments from logs, added -i flag feat: enabled data tags, description preset for Go, added -i flag Nov 4, 2024
@jonaslagoni jonaslagoni changed the title feat: enabled data tags, description preset for Go, added -i flag feat: enabled data tags, description preset for Go, add -i flag Nov 4, 2024
Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remember to add the new feature to the Go documentation https://github.com/TertiumOrganum1/modelina/blob/next/docs/languages/Go.md you can just use this as guideline: https://github.com/TertiumOrganum1/modelina/blob/next/docs/languages/TypeScript.md#rendering-comments-from-description-and-example-fields

We also need a single test ensuring that the preset works as expected, just take the one from TypeScript and change it to use Go 🙂 https://github.com/TertiumOrganum1/modelina/blob/next/test/generators/typescript/preset/DescriptionPreset.spec.ts

`${this.model.name} represents a ${this.model.name} model.`
);

const doc = '';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove it completely if it's no longer in use 🙂

…est for go description, removed previously added -i flag, removed unused code and fixed formatting, added modelina_cli/test/fixtures/generate to linter exclusions
@TertiumOrganum1
Copy link
Author

TertiumOrganum1 commented Nov 5, 2024

Remember to add the new feature to the Go documentation https://github.com/TertiumOrganum1/modelina/blob/next/docs/languages/Go.md you can just use this as guideline: https://github.com/TertiumOrganum1/modelina/blob/next/docs/languages/TypeScript.md#rendering-comments-from-description-and-example-fields

We also need a single test ensuring that the preset works as expected, just take the one from TypeScript and change it to use Go 🙂 https://github.com/TertiumOrganum1/modelina/blob/next/test/generators/typescript/preset/DescriptionPreset.spec.ts

Sorry, I don't understand what it wants from me. What does it mean by duplication? Take a look at go examples - they have the same index.spec.ts! But my test is 'duplicated'?
Could you please explain what does it want or even fix it? Or should I just delete my tests?

Copy link

sonarcloud bot commented Nov 5, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
6.0% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@TertiumOrganum1 TertiumOrganum1 changed the title feat: enabled data tags, description preset for Go, add -i flag feat: fixed data tags, description preset for Go, add goIncludeComments and goIncludeTags flags Nov 5, 2024
@jonaslagoni
Copy link
Member

/rtm

Copy link
Member

@jonaslagoni jonaslagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you might be missing to export the preset ✌️

@TertiumOrganum1
Copy link
Author

Looks like you might be missing to export the preset ✌️
What do you mean?
in go/presets/index.ts: export * from './DescriptionPreset';
in go/presets/DescriptionPreset.ts: export const GO_DESCRIPTION_PRESET: GoPreset = . . .
And on my PC modelina works as expected.
As far as I can see everything done similar to typescript generator.

@TertiumOrganum1
Copy link
Author

/ptal @jonaslagoni Hi, please advise what to do with my PR here. It didn't pass tests as modelina-cli uses modelina as npm package, but I've fixed both. Locally it all works but not in your CI. So should we split it into two PRs? If fix to modelina will be merged, how long should we wait to make PR to modelina-cli? Or maybe there is a way to disable some checks on this particular PR? How do you make changes in modelina&cli anyways? npm dependency makes them impossible

@asyncapi-bot
Copy link
Contributor

@kennethaasan @magicmatatjahu Please take a look at this PR. Thanks! 👋

@jonaslagoni
Copy link
Member

@jonaslagoni Hi, please advise what to do with my PR here. It didn't pass tests as modelina-cli uses modelina as npm package, but I've fixed both. Locally it all works but not in your CI. So should we split it into two PRs? If fix to modelina will be merged, how long should we wait to make PR to modelina-cli? Or maybe there is a way to disable some checks on this particular PR? How do you make changes in modelina&cli anyways? npm dependency makes them impossible

Yea, you right, completely forgot about that...

Split it up and as soon as it's released we can merge the CLI changes 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants