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

Logical binding aliases or binding renaming #144

Open
agentgt opened this issue May 12, 2023 · 3 comments
Open

Logical binding aliases or binding renaming #144

agentgt opened this issue May 12, 2023 · 3 comments
Labels
api brainstorm enhancement New feature or request
Milestone

Comments

@agentgt
Copy link
Contributor

agentgt commented May 12, 2023

With the exception of POJO getters JStachio uses the exact name to find bindings (variables/sections).

Thus if you want a variable named in kebab style like "inner-message" which is not a valid Java identifier you cannot do it.

This is a problem for folks coming from JSON based models where a such a naming style is more typical.

An obvious solution would be to offer an annotation that you can put on a field or method similar to Jackson's @JsonProperty this seems rather laborious and in some cases a model cannot be annotated.

So careful design considerations need to be made and more feedback.

If you would like to see some solution to this problem please thumb-up!

@agentgt agentgt added the enhancement New feature or request label May 12, 2023
@agentgt agentgt added this to the v1.1.0 milestone May 12, 2023
@agentgt agentgt modified the milestones: v1.1.0, v1.2.0 Jun 6, 2023
@agentgt agentgt modified the milestones: v1.2.0, v1.3.0 Jul 15, 2023
@dsyer
Copy link
Contributor

dsyer commented Jul 20, 2023

I would be OK with just converting kebab-case to camelCase and failing if it's not available. It happens at compile time right, so it's easy to spot?

@agentgt
Copy link
Contributor Author

agentgt commented Jul 20, 2023

It happens at compile time right, so it's easy to spot?

That is correct.

@agentgt
Copy link
Contributor Author

agentgt commented Jul 20, 2023

I have some hesitations that I can't really formulate yet into words about defaulting to converting kebab-case to camelCase.

Partly because kebab-case just happens to not be a valid Java identifier so it happens to be one of the only naming conventions that will work. Also I think it is the least likely used and probably what people will want is snake_case particularly if they have some JSON REST API where they have chosen snake_case.

I will wait to see someone complain about it some more to figure out use cases.

@agentgt agentgt modified the milestones: v1.3.0, v1.4.0 Aug 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api brainstorm enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants