-
-
Notifications
You must be signed in to change notification settings - Fork 468
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
YamlMember Alias isn't applied when using the CamelCaseNamingConvention #228
Comments
It appears this is a result of the changes made during: #190 |
More information is available in ticket: #215 |
The workaround mentioned in #215 works for me. I still think this behaviour is a bug though as it's unexpected. If an |
This behavior is not consensual. @veleek also has a valid argument for applying the naming convention after the alias. Maybe there should be a method on the builder to choose between the two behaviors? |
Sure but the example on the main website doesn't work as a result. |
You are right about the examples being broken. It has already been reported in #230, and this will need to be fixed. If you want to participate in that discussion, please comment on that thread. Thanks |
A method on the builder to switch modes for the entire context seems reasonable. Another option is adding a property to the YamlMember attribute that controls it for this specific member.
I quite like that as it means you could also disable the naming conventions on a member that doesn't have an alias. The "real" solution in my case is to go slap the data provider for using a single name which doesn't conform to the naming standards they use elsewhere. Then I wouldn't need aliases at all! But at this point it's "legacy code" that's hard for them to change. |
Maybe the suggestion of having a |
To recap (mainly to keep things straight in my mind): What we want is a way to turn off the The proposed approach would be adding a property called I can see three options for what he default can be:
The second option would globally disable NamingConventions and that feels wrong. The third option does work, but is overly complicated making it more fragile and possibly confusing to developers using the library. Finally, there's the first option. With that approach the |
Thanks for this recap. I am now convinced that defaulting to |
I added the |
If I ask a deserializer to use the
CamelCaseNamingConvention
then it appears to ignore or otherwise fail to use anAlias
declared using aYamlMember
attribute.What I Expected to Happen
The
CamelCaseNamingConvention
should be applied to all property names.The
YamlMember
Alias
should then override the property names where it exists.What Actually Happened
I get an exception saying the property can't be found despite using the
YamlMember
Alias
.Exception
Reproduction/Code
Here's a reproduction of the issue:
https://dotnetfiddle.net/ZOmLwf
And here's an example without the
CamelCaseNamingConvention
where it's working fine:https://dotnetfiddle.net/pwbw7R
Workaround
And here's a workaround I found in issue: #215
https://dotnetfiddle.net/RL9Eai
The text was updated successfully, but these errors were encountered: