wimdeblauwe / htmx-spring-boot

Spring Boot and Thymeleaf helpers for working with htmx
Apache License 2.0
521 stars 49 forks source link

Add builder to HtmxResponse #73

Closed xhaggi closed 1 year ago

xhaggi commented 1 year ago

There is one thing I would like to discuss. What do you think if we rename the template method in the builder to view, as you pass a view name (string), a View or a ModelAndView to this method? Spring also call it "view" in its documentation.

HtmxResponse.builder().view("myview").build();
wimdeblauwe commented 1 year ago

Interesting thought, although it might be strange to have a ModelAndView as parameter to a view(...) method. @dsyer what do you think about it?

dsyer commented 1 year ago

I don't really care if it's "template" or "view". Changing "addTemplate" to "template" (and a bunch of other changes in this rather large PR) is already a breaking change though, so probably shouldn't be in a minor release? I'm OK with things the way they are but if you want to change then it would need to be version 4.0.0 right?

wimdeblauwe commented 1 year ago

I don't really care if it's "template" or "view". Changing "addTemplate" to "template" (and a bunch of other changes in this rather large PR) is already a breaking change though, so probably shouldn't be in a minor release? I'm OK with things the way they are but if you want to change then it would need to be version 4.0.0 right?

It is not breaking at this point, as the current methods are still there and marked as deprecated. @xhaggi If Spring also calls it view in their docs, then I am ok with changing it to view() in the builder.

xhaggi commented 1 year ago

Ok great. The builder now uses view and everything else is still the same. I also spent some time reworking the HtmxResponseTest class. Now all the tests for the deprecated methods have gone into a nested test class, so each test exists for both. In the course of this, I have also revised the naming of the test methods.