cognitect-labs / vase

Data driven microservices
Eclipse Public License 1.0
373 stars 42 forks source link

#vase/query should allow empty params #77

Closed mgrbyte closed 7 years ago

mgrbyte commented 7 years ago

Description

A descriptor defined that omits :params should process the request (not 400)

Expected Behavior

The defined :query should execute and the respond be returned as normal.

Actual Behavior

HTTP 400 response, with error message: Missing required query parameters; One or more parameters wasnil. Got: Required: []

Steps to reproduce

Define an api route such as:

:vase/apis
 {:myapp/v1/gene
     "/count"
     {:get
      #vase/query {:name :roscoff.gene/count
                   :params nil
                   :query [:find (count ?e) .
                           :in $
                           :where [?e :gene/id _]]}}

Environment

Clojure 1.9.0-alpha13 lein

Operating System (including version).

DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"

Your current Leiningen/Boot/Maven version (lein --version)

Leiningen 2.7.1 on Java 1.8.0_131 OpenJDK 64-Bit Server VM

Pedestal and Vase version

Snipped from output of lein deps :tree | grep -E "(pedestal|vase)":

 [com.cognitect/pedestal.vase "0.9.0"]
 [io.pedestal/pedestal.jetty "0.5.1"]
 [io.pedestal/pedestal.service-tools "0.5.1" :scope "test"]
 [io.pedestal/pedestal.service "0.5.1"]
   [io.pedestal/pedestal.interceptor "0.5.1"]
   [io.pedestal/pedestal.log "0.5.1"]
   [io.pedestal/pedestal.route "0.5.1"]
ohpauleez commented 7 years ago

Thanks for using Vase and sorry you got snagged by this.

The error message is saying that you need the :params key with an empty binding form [] but instead it found you set the value to nil. You can see an example of that here

Additionally, I'd also recommend you upgrade to Vase 0.9.1 and Pedestal 0.5.2 to get the latest bugfixes and enhancements.