WorksHub / leona

spec -> lacinia schema
Eclipse Public License 1.0
36 stars 17 forks source link

Update automatic name conversion to use `PascalCase` #20

Closed JPRoland closed 5 years ago

JPRoland commented 5 years ago

Fixes issue #17

The fix broke most of the tests which required changing, but they all work now. I also may have done this entirely the wrong way, if so, well at least I learned more about clojure in the process...

My solution to getting the name conversion functions to work as intended feels a bit hacky to me, but I couldn't really think of another way to do it. Specifically, the camel-snake-kebab library couldn't convert the cases correctly for the namespaces due to the dots and slashes.

As an example: :leona.util-test/hello would convert to :Leona__utilTest___hello Rather than :Leona__UtilTest___Hello as would be expected. The opposite conversion was also not working, it would convert to :leona.-util-test/-hello

So, as a work around I added a couple utility functions that wrap the calls to the csk library so the correct separators would be preserved while converting the case.

Also fixed an issue with a misnamed test. In the tests for the util functions, one of the tests had the same name as one of the other tests and as such neither of them were running.

acron0 commented 5 years ago

@JPRoland Sorry for lack of feedback, we are having some internal discussions about this. I'll followup with more details.

acron0 commented 5 years ago

@JPRoland You've done exactly as issue #17 describes, however there's a mistake in the issue. I wrote

The powers that be would prefer if the automatic name conversion that currently performs snake_case on all names, would use PascalCase instead...

but actually, all names is incorrect. It should actually only be object names. This extends the scope of the issue significantly. I'm reluctant to take the PR, not because the code isn't good, but because it would mean having to make a new issue to put field names back to snake_case.

I understand if you don't want/have time to implement the additional work. If we leave your PR here then I, or some one else, can make the changes at some point.