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

Generate overwritten Equal method for C# models #466

Closed
jonaslagoni opened this issue Mar 6, 2023 · 8 comments
Closed

Generate overwritten Equal method for C# models #466

jonaslagoni opened this issue Mar 6, 2023 · 8 comments
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jonaslagoni
Copy link
Member

jonaslagoni commented Mar 6, 2023

Reason/Context

In Modelina for C#, you can make it generate the models with the Equal method overwritten, this should be possible through the CLI.

To do this I suggest we add a flag called csharpEqual as a boolean. If true the generator should include the following options:

presets: [
    {
      preset: CSHARP_COMMON_PRESET,
      options: {
        equal: true
      }
    }
  ]

Which should be added here:

fileGenerator = new CSharpFileGenerator();
as the code example shows: https://github.com/asyncapi/modelina/blob/master/examples/csharp-generate-equals-and-hashcode/index.ts

These will be the generated results: https://github.com/asyncapi/modelina/blob/master/examples/csharp-generate-json-serializer/__snapshots__/index.spec.ts.snap

Remember to also add a test here:

describe('for C#', () => {

Related documentation: https://github.com/asyncapi/modelina/blob/master/docs/languages/Csharp.md#generate-models-with-equals-and-gethashcode-methods

Feel free to reach out if you have any questions or get stuck!

@jonaslagoni jonaslagoni added the enhancement New feature or request label Mar 6, 2023
@Souvikns Souvikns added the good first issue Good for newcomers label Mar 6, 2023
@sambhavgupta0705
Copy link
Member

Hi @jonaslagoni I would like to work on this issue.

@kaushik-rishi
Copy link
Contributor

Working on this along with #467
I'm planning to figure both out together.

@kaushik-rishi
Copy link
Contributor

@jonaslagoni can we close this issue as well as it's fixed.

@kaushik-rishi
Copy link
Contributor

@jonaslagoni this can be closed 😄

@jonaslagoni
Copy link
Member Author

@kaushik-rishi you have to get a codeowner to do it 😄

@kaushik-rishi
Copy link
Contributor

Oh didn't know who can I request for then?

@jonaslagoni
Copy link
Member Author

jonaslagoni commented May 26, 2023

You can always find them in the https://github.com/asyncapi/cli/blob/master/CODEOWNERS file 🙂 Every repository has these.

@kaushik-rishi
Copy link
Contributor

@Souvikns This can be closed. It's fixed in #583

@Souvikns Souvikns closed this as completed Jun 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants