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

Percent symbol '%' can be inserted as a property name #453

Closed
XeClutch opened this issue Sep 4, 2024 · 5 comments · Fixed by #455
Closed

Percent symbol '%' can be inserted as a property name #453

XeClutch opened this issue Sep 4, 2024 · 5 comments · Fixed by #455
Assignees
Labels
bug Something isn't working

Comments

@XeClutch
Copy link

XeClutch commented Sep 4, 2024

Describe the bug
When using the Refitter Source Generator, if a percent symbol is used as a property name in the OpenAPI spec, that same percent symbol will be inserted into the name of the property in the generated C#, violating C# property naming rules.

Screenshots

OpenAPI Specifications
https://api.percipio.com/reporting/swagger.json

@XeClutch XeClutch added the bug Something isn't working label Sep 4, 2024
@christianhelle
Copy link
Owner

@XeClutch Thanks for taking the time to report this. I'm surprised but the OpenAPI spec example provided is valid. I'm not sure how to handle such a property name but I'll see what I can do

@christianhelle
Copy link
Owner

@all-contributors please add @XeClutch for bugs

Copy link
Contributor

@christianhelle

I've put up a pull request to add @XeClutch! 🎉

@christianhelle
Copy link
Owner

This is a tough one as I rely completely on NSwag for generating the contracts/models and this needs to be addressed in NSwag instead of Refitter.

@christianhelle
Copy link
Owner

This is a tough one as I rely completely on NSwag for generating the contracts/models and this needs to be addressed in NSwag instead of Refitter.

Scratch that... we can fix this from Refitter as we use a custom property name generator that addresses this kind of problem.

@XeClutch I have a fix on the way where the property % ofVideoOrBook will be generated as public string Percent_ofVideoOrBook {get; set; }. We already handle spaces by replacing them with an underscore, and changing that breaks it for other users

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants