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

Fix/c sharp member name casing #806

Merged
merged 10 commits into from
Aug 5, 2024

Conversation

mariusmuntean
Copy link
Contributor

Description

Using new config option named memberNameConvention, the casing of the interface/class/record members can be controlled.
Supported values are camelCase and pascalCase.
The default value is camelCase to avoid unexpected behaviour of this plugin from the people already using it.

Related #798

Type of change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Added tests for interface, class and records where both camelCase and pascalCase naming is tested.

  • Should generate camelCase properties for input type fields
  • Should generate pascalCase properties for input type fields
  • Should generate a C# class with camel case property names for type
  • Should generate a C# class with pascal case property names for type
  • Should generate C# record with camel case property names
  • Should generate C# record with pascal case property names
  • Should generate C# interface with camelCase properties
  • Should generate C# interface with pascalCase properties

Test Environment:

  • OS: macOS 14.5
  • "@graphql-codegen/c-sharp-common": "1.0.0",
  • "@graphql-codegen/plugin-helpers": "^3.0.0",
  • "@graphql-codegen/visitor-plugin-common": "^2.12.1",
  • "change-case-all": "1.0.15",
  • "tslib": "~2.6.0",
  • "unixify": "^1.0.0"
  • NodeJS: v16.13.2

Checklist:

  • I have followed the
    CONTRIBUTING doc and the
    style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Copy link

changeset-bot bot commented Aug 1, 2024

🦋 Changeset detected

Latest commit: f044f3c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@graphql-codegen/c-sharp

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

can you run yarn changeset and explain the changes there so it can be part of release notes. Other than that seems reasonable to me

@mariusmuntean mariusmuntean marked this pull request as ready for review August 5, 2024 19:50
@mariusmuntean
Copy link
Contributor Author

@saihaj I added the changeset with the type minor because there's no braking change, just new functionality.

Copy link
Collaborator

@saihaj saihaj left a comment

Choose a reason for hiding this comment

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

great work!

@saihaj saihaj merged commit d1d6d6e into dotansimha:main Aug 5, 2024
14 checks passed
@mariusmuntean
Copy link
Contributor Author

mariusmuntean commented Aug 5, 2024

Besides this plugin (c-sharp) there's the c-sharp-operations plugin. I think the c-sharp-operations plugin would benefit from the new config as well.
I'm volunteering again to make the new config available in c-sharp-operations as well.

Should I open a new issue or can I start working on the PR right away? I could also extend the description of #798 to mention the c-sharp-operations plugin.

@mariusmuntean mariusmuntean deleted the fix/CSharpMemberNameCasing branch August 5, 2024 21:08
@saihaj
Copy link
Collaborator

saihaj commented Aug 5, 2024

I'm volunteering again to make the new config available in c-sharp-operations as well.

Thank you!

can I start working on the PR right away?

feel free to just send in the PR

@mariusmuntean
Copy link
Contributor Author

@saihaj I added a new PR (#816) to add the same functionality to the c-sharp-operations plugin. I used this opportunity to move any shared code to c-sharp-common to avoid duplication.

@saihaj
Copy link
Collaborator

saihaj commented Sep 5, 2024

released @graphql-codegen/c-sharp@5.1.0

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