Fork me on GitHub
#pedestal
<
2024-05-28
>
hlship21:05:27

I just pushed 0.7.0-beta-3. Not bothering with a formal release announcement, but this includes the fixes to the specs so that they operate in the correct namespace, and a few tweaks to the code that helps with writing responses.

souenzzo22:05:25

I know that specs aren't for a fully precise description of the functions but https://github.com/pedestal/pedestal/blob/0.7.0-beta-3/service/src/io/pedestal/http/specs.clj ::http/service-map Has ::http/port as required and ::http/routes as optional, and is used in http/create-servlet :args spec using this form:

(require '[io.pedestal.http :as http]
  '[io.pedestal.test :refer [response-for]])
(let [{::http/keys [service-fn]} (http/create-servlet {::http/port   3333
                                                       #_#_::http/routes #{}})]
  (response-for service-fn :get "/"))
we can see that • ::http/routes is required • ::http/port is not required The same for http/create-server. And more. You define ::http/port as a pos-int?, that exclude 0, that is a valid value (it takes a "random availble port", in jetty, not sure other engines).

hlship22:05:18

Thanks for looking at this.

hlship22:05:45

Much of this is not the way I would have liked to see it set up on day 1, but I wasn't here on day 1.

hlship22:05:07

Really, what's missing is a sense of all the combinations of keys that are needed.

hlship22:05:33

::http/routes isn't required, because it isn't needed when :http/router is supplied.

hlship22:05:42

I think these specs are useful in terms of if you supply a value it is checked by the specs. It does a worse job of ensuring that a consistent set of keys/values are supplied.

👍 2
hlship21:05:02

Also, documentation changes.