Open kortirso opened 2 months ago
maybe I can share their implementation and then dicsuss/modify/accept/reject them, what do you think?
Yes. I'd like to discuss that!
Would you be open to creating 3 separate PRs / issues? At the very least, I can give architectural context/guidance for each of them.
Nice pr in #31 @kortirso! I'll take a look later this week. I feel like that one might take a bit more time for me to review. If you are open to PRing for json.extract
that seems like a great low hanging fruit and much easier for me to review. Followed by json.partial!
Also as you're migrating from jbuilder
to props_template
, one thing i recommend is to avoid autocamelizing your keys as it may slow your views down.
@jho406 what is better approach for formatting keys?
json.first_value
with changing method format_key
json.firstValue
(if we need camelCased format)The latter.
direct json.firstValue (if we need camelCased format)
Do it directly. Its a low effort approach, speedy, and if you plan to use it in JS land, easier to search for.
While we were integrating props into our application, we added some additional APIs that were spied on by the Jbuilder.
1)
json.optional!
- defines attribute or structure and marks it as optional, during serialization this method checks condition and renders or does not render such attributeexample of usage
2)
json.extract!
- extracts the mentioned attributes or hash elements from the passed object and turns them into attributes of the JSONexample of usage -
json.extract! object, :id, :unit
instead of
3)
json.partial!
- renders partial without setting result to some key@jho406 do you have any plans to integrate such features to PropsTemplate? Or maybe I can share their implementation and then dicsuss/modify/accept/reject them, what do you think?