Yes, I think multispec is one option, or just s/or of course (when 
conformed, that will give you a tag telling you which one it is, which 
might be useful). The other consideration is that the multispec is based on 
a multimethod so it can be externally extended later rather than by 
modifying an existing spec. But maybe that's unimportant for you.

On Monday, December 18, 2017 at 8:19:13 AM UTC-6, Jonathon McKitrick wrote:
>
> I'm really diving into spec now, and I'd like to have a spec that covers 
> successful http responses, but also allows me to conform different body 
> content.
>
> For example, in one case I just expect raw html, but in another, JSON with 
> a specific structure.
>
> Are spec multimethods the correct way to do this, or are there other 
> options?
>
> I considered have different 'body' specs with names that make sense, but 
> since the spec name must match the key name, the specs all have to be 
> 'body', correct?
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to