luminus

Prem Kurian Philip 2021-06-09T07:47:12.023600Z

Have you tried restarting the code? (lein run?) or you could reload the core.clj within VSCode?

Prem Kurian Philip 2021-06-09T07:48:49.024600Z

I have a question about returning a JSON response. I am trying to return a map like this: (def Product {:id int :product_id int :product string? :package_type string? :package_type_description string? :is_discrete string? :category string? :manufacturer string? :brand string? :image string? :tag string? :weight float :unit string? :uom_id int :catalogue_id int :price float? :sale_price float? :price_with_tax float? :tax_category_id int? :tax_rate string? :tax_fields string?}) (def Products [Product]) And I have a route setup to return the list of products like this: ["/products-search" {:get {:summary "Returns the list of product details by name" :parameters {:query {:search string?}} :responses {200 {:body {:products Products}}} :handler (fn [{{{:keys [search]} :body} :parameters}] (do (def products (db/get-products-details-by-name {:name-like (str search "%")})) {:status 200 :body {:products products}}))}}] However, I am getting an error when I try and execute this from withing Swagger-UI. The error message I am getting is:

{
  "spec": "(spec-tools.core/spec {:spec (clojure.spec.alpha/keys :req-un [:spec$21193/products]), :type :map, :leaf? false})",
  "problems": [
    {
      "path": [
        "products",
        "price_with_tax"
      ],
      "pred": "clojure.core/float?",
      "val": 22,
      "via": [
        "spec$21193/products",
        "spec$21193$products/price_with_tax"
      ],
      "in": [
        "products",
        0,
        "price_with_tax"
      ]
    },
    {
      "path": [
        "products",
        "tax_fields"
      ],
      "pred": "clojure.core/string?",
      "val": null,
      "via": [
        "spec$21193/products",
        "spec$21193$products/tax_fields"
      ],
      "in": [
        "products",
        0,
        "tax_fields"
      ]
    },
    {
      "path": [
        "products",
        "tax_rate"
      ],
      "pred": "clojure.core/string?",
      "val": null,
      "via": [
        "spec$21193/products",
        "spec$21193$products/tax_rate"
      ],
      "in": [
        "products",
        0,
        "tax_rate"
      ]
    },
    {
      "path": [
        "products",
        "brand"
      ],
      "pred": "clojure.core/string?",
      "val": null,
      "via": [
        "spec$21193/products",
        "spec$21193$products/brand"
      ],
      "in": [
        "products",
        0,
        "brand"
      ]
    },
    {
      "path": [
        "products",
        "sale_price"
      ],
      "pred": "clojure.core/float?",
      "val": 22,
      "via": [
        "spec$21193/products",
        "spec$21193$products/sale_price"
      ],
      "in": [
        "products",
        0,
        "sale_price"
      ]
    },
There is more but truncating to this point for now. Some of the fields such as "tax_rate" could have null values. Would really appreciate some pointers

Ovidiu Stoica 2021-06-09T08:44:57.025700Z

Hello, is there an open source luminus project that uses JWT tokens for authentication with luminus or some documented examples of this?

👍 1
Juλian (he/him) 2021-06-09T11:08:32.025900Z

Luminus lists auth-jwe in its app profiles, is this related? at least it adds the dependency buddy.sign.jwt