Fork me on GitHub
#pedestal
<
2020-12-07
>
souenzzo19:12:38

How can I turn things like /foo/{id} (swagger/openapi path specs) into something that pedestal understand, like /foo/:id

souenzzo19:12:03

(string/replace "/foo/{bar}/car/{var}"
                #"(\{[^\}]+\})"
                (fn [[v _]]
                  (str ":" (subs v 1 (dec (count v))))))

souenzzo22:12:58

I'm still looking for a "final solution" for this issue

simongray07:12:19

seems good enough to me. What’s wrong with using regex?

simongray07:12:16

You could cut down a bit by using an inner group, I think:

(string/replace "/foo/{bar}/car/{var}"
                 #"(\{([^\}]+)\})"
                 (fn [[_ _ token]]
                   (str ":" token)))

simongray07:12:23

then the function gets [full-match, outer-group, inner-group] as its input.

souenzzo09:12:42

I'm implementing a REST interface that flows google style it use things like "/orders/{order-id}/fulfillments:create-with-invoice" https://cloud.google.com/apis/design/custom_methods I still don't know how to handle this in pedestal. Not even writing the path "manually"

souenzzo09:12:42

I'm implementing a REST interface that flows google style it use things like "/orders/{order-id}/fulfillments:create-with-invoice" https://cloud.google.com/apis/design/custom_methods I still don't know how to handle this in pedestal. Not even writing the path "manually"