asyncapi / modelina

A library for generating typed models based on inputs such as AsyncAPI, OpenAPI, and JSON Schema documents with high customization
https://modelina.org
Apache License 2.0
313 stars 184 forks source link

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

Open TertiumOrganum1 opened 1 week ago

TertiumOrganum1 commented 1 week ago

Why do we need this improvement?

Golang generator should include comments from parameter descriptions

How will this change help?

Golang generator should include comments from parameter descriptions

Screenshots

No response

How could it be implemented/designed?

Golang generator should include comments from parameter descriptions

🚧 Breaking changes

No

👀 Have you checked for similar open issues?

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue?

None

github-actions[bot] commented 1 week ago

Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup 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.

jonaslagoni commented 1 week ago

Makes sense, happy to accept PRs 🙏

toffee-k21 commented 1 week ago

Hey @jonaslagoni, I think this change should apply to all the languages we support, not just Golang

jonaslagoni commented 1 week ago

Feel free to create an issue per language where this is missing (some already have it), or jump straight into a PR @toffee-k21 ✌️

TertiumOrganum1 commented 1 week ago

Feel free to create an issue per language where this is missing (some already have it), or jump straight into a PR @toffee-k21 ✌️

What do you mean - per language? I've specified Golang in the title. I can't fix it myself in your code, but it should be very quick for those how know modelina codebase

jonaslagoni commented 1 week ago

We got multiple languages that dont have a preset that include descriptions.

I can't fix it myself in your code, but it should be very quick for those how know modelina codebase

This is the basic recipe:

  1. Copy https://github.com/asyncapi/modelina/blob/master/src/generators/typescript/presets/DescriptionPreset.ts to start off with for Go https://github.com/asyncapi/modelina/tree/master/src/generators/go
  2. Adapt the preset
  3. Add a test
  4. Create a PR
TertiumOrganum1 commented 1 week ago

We got multiple languages that dont have a preset that include descriptions.

I can't fix it myself in your code, but it should be very quick for those how know modelina codebase

This is the basic recipe:

  1. Copy https://github.com/asyncapi/modelina/blob/master/src/generators/typescript/presets/DescriptionPreset.ts to start off with for Go https://github.com/asyncapi/modelina/tree/master/src/generators/go
  2. Adapt the preset
  3. Add a test
  4. Create a PR

sorry this code doesn't make sense to me at all, I'm from c++/go

TertiumOrganum1 commented 2 days ago

We got multiple languages that dont have a preset that include descriptions.

I can't fix it myself in your code, but it should be very quick for those how know modelina codebase

This is the basic recipe:

  1. Copy https://github.com/asyncapi/modelina/blob/master/src/generators/typescript/presets/DescriptionPreset.ts to start off with for Go https://github.com/asyncapi/modelina/tree/master/src/generators/go
  2. Adapt the preset
  3. Add a test
  4. Create a PR

DescriptionPreset.ts.txt

Ok, I've copied and adopted DescriptionPreset.ts from typescript to go, added it to go/presets/index.ts, but it never called and no comments in my generated sources. What should I do to make it work?

nothing new in comments, annoying "ResponsePayload represents a ResponsePayload model" still exists, so I assume that my preset even doesn't called. Maybe it is not plugged in inside modelina for golang?