HavenDV/OpenApiGenerator

handle properties with numeric identifiers

Closed this issue · 5 comments

image

        /// <summary>
        /// 
        /// </summary>
        [global::System.Text.Json.Serialization.JsonPropertyName("300x200")]
        public string? 300x200 { get; set; }

Hi. Can you provide OpenAPI spec? I will test it and fix all issues, or maybe even add this to test cases and ensure it compiles without any problems.

There is already a fix for such cases for enums, so I just applied it for properties. Should be on NuGet within 5 minutes

If you have a fix already, that'll be great; added example property to test case in PR.

Can revert the 'fix' part if necessary to make the PR just the test case.

Edit: I see the merged PR. 👍

I will close this for you as soon as I update the nuget package and test my code base.

The properties are thumbnail image sizes.

If there are any unrelated issues, I'll also close this ticket and make a new one to address those, but I think this is all that is needed. 👍

Everything is fine, I think your fix is ​​better and covers a wider range of options, where properties begin not only with numbers, but in general all invalid beginnings of properties
But for testing, I would prefer to create some new openapi spec based on petstore in order to define special cases like this. I'll put your test data in this OpenAPI spec
Thanks for testing and I'll be happy to fix any other problems if they arise.
Now my main priority for the coming days is support for AnyOf/OneOf, where special types/Json Converters will be generated in such cases. This is needed to support the OpenAI specification