rails / jbuilder

Jbuilder: generate JSON objects with a Builder-style DSL
MIT License
4.34k stars 440 forks source link

Support Strict Locals #557

Closed seanpdoyle closed 7 months ago

seanpdoyle commented 10 months ago

When scaffolding out partials, generate template files with a Strict Locals magic comment based on the name of the resource (for example, # locals: (post:) when generating _post.json.jbuilder).

seanpdoyle commented 10 months ago

This is facing issues similar to https://github.com/rails/rails/issues/49761 (which was resolved by https://github.com/rails/rails/pull/49782).

casperisfine commented 10 months ago

Do you need help to fix this, or are you on it?

seanpdoyle commented 10 months ago

@casperisfine I've shared some thoughts in https://github.com/rails/rails/pull/50864#pullrequestreview-1843455961, but it seems like the public API around strict and implicit locals is insufficient for templating engines.

I believe that'll take some effort to resolve, so I think I'll need some help.

dhh commented 7 months ago

I'm not a fan of strict locals, and I'm not interested in them being used by default.