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

Property named '-1' generates wrong C# Property name #1710

Open
bstordrup opened this issue Jun 28, 2024 · 0 comments
Open

Property named '-1' generates wrong C# Property name #1710

bstordrup opened this issue Jun 28, 2024 · 0 comments

Comments

@bstordrup
Copy link

The following definition

      "reaction-rollup": {
        "title": "Reaction Rollup",
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "total_count": {
            "type": "integer"
          },
          "+1": {
            "type": "integer"
          },
          "-1": {
            "type": "integer"
          },
          "laugh": {
            "type": "integer"
          }
        },

generates the C# property name Plus1 as expected, but _1 for the -1. I would expect it to become Minus1.

Also, the parameter names for the method are causing compilation errors - they should follow the Property name generation.

        public ReactionRollup(int @+1, int @1, int @laugh, int @total_count, System.Uri @url)

        {

            this.Url = @url;

            this.Total_count = @total_count;

            this.Plus1 = @+1;

            this._1 = @1;

            this.Laugh = @laugh;

        }

For the property names generation, I think it can be solve din the CSharpPropertyNameGenerator. Not sure about the parameter names though.

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

No branches or pull requests

1 participant