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: enabled data tags, description preset for Go, add -i flag #2123

Open
wants to merge 4 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 ddf971c
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/67280fcdae70380008861d67

Copy link

sonarcloud bot commented Nov 4, 2024

@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 🙂

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

Successfully merging this pull request may close these issues.

2 participants