Fork me on GitHub
#reitit
<
2019-05-10
>
deva01:05:32

First of all Thanks for the awesome framework

{:get {:summary "Lists all "
         :parameters {:path {:pageNo integer?}
                      :query {:accessZone string?
                              :facilityId int?
                              :isAllInActivePatientsSearch boolean?
                              :dischargedPatientsSearch boolean?
                              :order string?
                              :type string?
                              :searchQuery string?}}
how can I make some of the query params optional?

deva01:05:50

:opt-un ?

deva01:05:46

^^ Can anyone please help?

deva01:05:58

nvm, I figured it out.

deva01:05:04

Is there any away to define them as optional inline? Like in schema.core :return {(s/optional-key :message) s/Str}

deva03:05:14

How come these are conflicting routes ?

Router contains conflicting route paths:

   /api/patient/:patientId
-> /api/patient/admission

   /api/patient/:patientId/move-to-cic
-> /api/patient/pcp/:patientId

   /api/patient/:patientId/move-to-observation
-> /api/patient/pcp/:patientId

deva03:05:43

Doesn’t router consider types there ?

ikitommi06:05:55

@petr could you tell more about your setup? sendinf arraybuffer directly to a handler? Or is the web server passing arraybuffer as :body?

ikitommi06:05:23

@gdrte there is spec-tools.data-spec/opt and spec-tools.data-spec/req to wrap keys, e.g. :query {:accessZone string?, (ds/opt :facilityId) int?}

ikitommi06:05:29

@gdrte routes are just strings, for example in the last conflict, a path of /api/patient/pcp/move-to-observation would match both routes. If you really need those, you can disable the conflict resolution with :conflicts nil router option. Uses linear-router so the first match is used.

deva20:05:25

This doesn't look correct to me. That's the reason why :patientId is spec'd as int?

deva20:05:37

If routes are just strings, why do we want to declare the types in parameters?

deva20:05:58

Are they just for generating swagger docs?

PB15:05:52

@ikitommi I was passing the array buffer as the :body which is picked up by a handler function

ikitommi16:05:33

@petr reitit defaults to muuntaja (https://github.com/metosin/muuntaja) for body decoding, I think it doesn't read array buffers. I believe most (if not all?) web servers pass it as InputStream. If you need buffers, you could: 1) pre-process or parse it yourself (custom mw or interceptor) 2) use some other body mw/int that does that 3) a PR to Muuntaja to support it