Web Development with Clojure, Third Edition: /api/messages endpoint spec out of date (page 184)

Testing the addition of the author in the message listing (page 184) fails to load messages as the /api/messages body spec (originally defined on page 109) omits an author spec along the lines of (s/nilable string?)

Apologies if I have missed a step somewhere, is there a reference repo to check things like this against?

1 Like

Thought I’d add for other readers that (ds/maybe string?) appears to be the correct way to specify a nilable string when using data-spec

1 Like

Hi there. All of the code is available on the PragProg website. If you go to https://www.pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/ you’ll find a source code link to download a zip file of all the code used in the book.

That version of the project will be under guestbook-author-2.

I’m surprised that the endpoint fails to load messages for you. Since we’re using spec-coercion, and clojure.spec is open, it should load extra keys without issue as long as the specced keys conform. We’ll add a note to that section mentioning this, and we’ll expand the spec coverage later in the book.

In the meantime, could you send the error you’re experiencing?

Thanks for reading!

1 Like

I went back in my history to get the error to post and I can’t reproduce it.
I’m not sure how I managed to get a spec error, but it appears to have been my mistake.
Sorry for the false error.

P.S. really enjoying the book so far. I’m a clojure beginner and a complete web-dev noob but the book is still accessible to me.

2 Likes