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!: add union types support in go #1882

Merged
merged 13 commits into from
Apr 4, 2024

Conversation

Souvikns
Copy link
Member

@Souvikns Souvikns commented Mar 11, 2024

Description

This PR adds support for union types in go.

Related Issue

closes #1842

Checklist

  • The code follows the project's coding standards and is properly linted (npm run lint).
  • Tests have been added or updated to cover the changes.
  • Documentation has been updated to reflect the changes.
  • All tests pass successfully locally.(npm run test).

Additional Notes

Copy link

netlify bot commented Mar 11, 2024

Deploy Preview for modelina canceled.

Name Link
🔨 Latest commit 7684385
🔍 Latest deploy log https://app.netlify.com/sites/modelina/deploys/660e65422ea501000920385c

@jonaslagoni
Copy link
Member

Also remember to add an entry into the migration guide for v4 as this is a breaking change for Go ✌️

@Souvikns Souvikns requested a review from jonaslagoni March 15, 2024 06:16
@jonaslagoni
Copy link
Member

@kennethaasan since you also seem to do some stuff in go atm, want to have a look?

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.

Few comments ✌️

@Souvikns Souvikns requested a review from jonaslagoni March 21, 2024 06:52
@Souvikns Souvikns requested a review from jonaslagoni March 28, 2024 08:33
@jonaslagoni jonaslagoni changed the title feat: add union types support in go feat!: add union types support in go Mar 28, 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.

Think the only thing missing is adding the example to the list of examples and adapting the go docs to reflect you can change the name of some of the Union fields ✌️


export interface GoOptions extends CommonGeneratorOptions<GoPreset> {
typeMapping: TypeMapping<GoOptions, GoDependencyManager>;
constraints: Constraints<GoOptions>;
unionAnyModelName: string;
Copy link
Member

Choose a reason for hiding this comment

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

Please add JS doc to each of these options so people got some idea when trying to use it instead of having to look it up ✌️

Copy link
Member

Choose a reason for hiding this comment

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

Will the developer know what unionAnyModelName means by reading the description you just provided?

const jsonSchemaDraft7 = {
$schema: 'http://json-schema.org/draft-07/schema#',
type: 'object',
additionalProperties: {
Copy link
Member

Choose a reason for hiding this comment

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

Do you mind changing the example so it outputs multiple Union types and then use the options for naming so we reflect those options you added?

Copy link
Member

Choose a reason for hiding this comment

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

@Souvikns you never adapted the options to include all the unionAnyModelName and others. Right now users have no idea the options are there.

@Souvikns Souvikns requested a review from jonaslagoni April 1, 2024 05:47
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.

@Souvikns please read the comments 🙂

Copy link

sonarqubecloud bot commented Apr 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

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.

Awesome @Souvikns 👍

@jonaslagoni
Copy link
Member

/rtm

@jonaslagoni jonaslagoni merged commit 8b1ab56 into asyncapi:next Apr 4, 2024
16 checks passed
@asyncapi-bot
Copy link
Contributor

🎉 This PR is included in version 4.0.0-next.26 🎉

The release is available on:

Your semantic-release bot 📦🚀

jonaslagoni pushed a commit to jonaslagoni/generator-model-sdk that referenced this pull request Apr 29, 2024
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