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

ToCamelCase extension works wrong for ending Id #1480

Closed
lekrus opened this issue Jul 10, 2020 · 2 comments
Closed

ToCamelCase extension works wrong for ending Id #1480

lekrus opened this issue Jul 10, 2020 · 2 comments

Comments

@lekrus
Copy link

lekrus commented Jul 10, 2020

Expected Behavior

"AgreementId".ToCamelCase(CultureInfo.InvariantCulture).Should().Be("agreementId");

Actual Behavior

in 106.10.1 that works as expected
in 106.11.4 that returns "agreementid", so CamelCaseJsonSerializerStrategy works incorrectly

@deburau
Copy link

deburau commented Aug 31, 2020

This is a big problem for me, too. Now I have to add DeserializeAs attributes to get things working again.

I propose to add the following tests to the ToPascalCase test in StringExtensionsTests.cs:

TestCase("thisIsAnotherTest", true, "ThisIsAnotherTest"), TestCase("thisIsAnotherTest", false, "Thisisanothertest")

and fixing ToCamelCase.

@liquidboy
Copy link
Contributor

liquidboy commented Oct 9, 2020

ive hit something similar to this too ...

pre 106.11.2 (working ToCamelCase in a strategy)

image

post 106.11.2+ (broken ToCamelCase, all properties are lowercase now)

image

doing as @deburau suggests and adding a DeserializeAs attribute everywhere is not feasible ..

Looking at the code changes for the StringExtensions, and i believe this is where the logic changed that is causing this issue.. I.e. it is now doing a ToLower aggressively, where as before (on the left) it was only doing it if the "rest of the word was uppercase"

image

alexeyzimarev added a commit that referenced this issue Oct 23, 2020
fix #1480 - ToCamelCase broken for a single word with multiple upperc…
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

3 participants