mathieuprog / polymorphic_embed

Polymorphic embeds in Ecto
Apache License 2.0
340 stars 62 forks source link

Create a separate package for view-related code #101

Closed mathieuprog closed 5 months ago

mathieuprog commented 5 months ago

I'd like to separate the code related to the view from the core/Ecto-related code.

Reason: while the core remains stable and should never or rarely introduce a breaking change (one of the library's core principle is to keep the API and behavior as close as possible from the Ecto embed_one/many functions, which never break), the view-related code keeps breaking and keeps introducing major versions.

I'd like to create one new package. I was thinking of the names:

Which name(s) would be most suitable? Votes welcome!

woylie commented 5 months ago

I think it would make sense to mirror the naming of the Phoenix packages:

I don't see a reason for a separate component package, since everything is HEEx now, and both HEEx and Phoenix.Component are part of LiveView. And _view sounds like it would it would be related to phoenix_view, which is only for Phoenix applications before version 1.6.

mathieuprog commented 5 months ago

Did you suggest 2 packages? I think we need only one package, as just as we said earlier, the functions in the HTML.Form are to be removed. All we have left is polymorphic_embed_inputs_for/1 currently in Component as well as a small helper function to case on the type.

woylie commented 5 months ago

Ah, I misread your suggestion. Then my preference would be polymorphic_embed_html.

mathieuprog commented 5 months ago

Actually me too, settled:) (edited to make more clear)

SteffenDE commented 5 months ago

Woops, I'm late to the party. Just wanted to suggest another naming scheme:

polymorphic_embed_phoenix or phoenix_polymorphic_embed (I'd prefer the first one)

That's how the mailing libraries bamboo (https://github.com/thoughtbot/bamboo_phoenix) or swoosh (https://github.com/swoosh/phoenix_swoosh) named their libraries integrating with Phoenix. As this will use phoenix_html / phoenix_live_view (heex) for rendering, maybe including phoenix in the name would make sense?

If it's settled on polymorphic_embed_html, I think that's fine too :)

mathieuprog commented 5 months ago

Wait that's even better. Any comment @woylie before I commit to it?:D

woylie commented 5 months ago

polymorphic_embed_phoenix sounds good to me!