Skip to content

Type mismatch when using Liberator resources #175

@johnboy14

Description

@johnboy14

When attempting to use the :return keyword in my GET* function, I get a strange response error

{
  "errors": "(not (sequential? a-java.lang.String))"
}

When I remove the :return keyword I don't get the error above. I assume the function that handles the schema validation is only expecting a body. Does anyone else use Liberator in conjunction with the swagger-docs function?.

(context* "/search" []
            :tags ["search"]

            (GET* "/" []
                  :return [UserProfile]
                  :query-params [term :- s/Str]
                  :summary "returns ok"
                  search-term))

Profile schema

(defschema UserProfile {:email Str
                        :img_url Str})

Liberator Resource. search-for-term returns a vector of maps.

(defresource search-term
             :authorized? true
             :allowed-methods [:get]
             :available-media-types ["application/json"]
             :handle-ok (fn [ctx]
                          (search-for-term (get-in ctx [:request :params :term]))))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions