Comments (2)
Hi,
The code on the test readme looks like this:
(-> (martian/bootstrap-swagger "https://api.com" user-api-swagger-definition)
(martian-test/respond-with-generated {:load-user :success}))
The respond-with-generated
looks for and replaces the perform-request
interceptor that comes from the various martian-http
packages and also removes body (de)serialisation, so it should not matter if you use martian-http
or martian.core
from that perspective.
Could you share some code and tell me about the behaviour / errors you are seeing?
Cheers
from martian.
The primary issue is that my client doesn't use Swagger, and I rely on routes for my API. Is there a way to test this scenario, or does the library not support it?
This situation is not unique to my current project; in fact, many of my projects lack Swagger, and I employ this approach.
Code examples:
(defn bootstrap
[token store & {:keys []}]
(martian-http/bootstrap
(base-url store)
(routes/prepare-routes)
{:credentials {:token token}
:interceptors (concat martian/default-interceptors
[(add-auth-headers)
(ignore-invalid-cookies)
interceptors/default-encode-body
(decode-body)
martian-http/perform-request])}))
(ns shopify.impl.routes
(:require
[schema.core :as s]))
(def orders
[{:route-name :get-orders
:method :get
:path-parts ["/orders.json"]
:query-schema {(s/optional-key :page_info) s/Str
(s/optional-key :financial_status) s/Str
(s/optional-key :status) s/Str
(s/optional-key :limit) s/Int
(s/optional-key :created_at_min) s/Str
(s/optional-key :created_at_max) s/Str
(s/optional-key :order) s/Str}}])
(def fulfillment
[{:route-name :get:fulfillment-order!
:method :get
:path-parts ["/orders/" :order-id "/fulfillment_orders.json"]
:path-schema {:order-id s/Int}}
{:route-name :create-fulfillment
:method :post
:path-parts ["/fulfillments.json"]
:body-schema {:body {:fulfillment {:message s/Str
:notify_customer s/Bool
:tracking_info {:number s/Str
:url s/Str}
:line_items_by_fulfillment_order [{:fulfillment_order_id s/Int}]}}}}])
(def routes
[orders fulfillment])
(defn prepare-routes
[]
(reduce into [] routes))
I'm not encountering any errors (just get nil because haven't Swagger I think), but I'm struggling to grasp how to implement this for my specific situation.
I would greatly appreciate your assistance
from martian.
Related Issues (20)
- Bootstrapping relative url for a swagger api from cljs doesn't work
- Unable to use martian over spotinst API HOT 4
- Use clj-commons/clj-http-lite? HOT 5
- Unclear how to use query-params when bootstrapping without openapi/swagger HOT 6
- Is it possible to use a file:// url for the openapi deifinition? HOT 2
- Can't find a way to use $ref parameters HOT 3
- Throw an exception on status code >= 400 or :error HOT 2
- VCR playback should terminate if it has a response
- Invalid cookie header HOT 3
- Exception when generating no content response HOT 1
- No matching content-type available for `application-json` HOT 6
- Endpoint with content type of application/yaml does not seem to be supported HOT 1
- Adding custom encoder does not get chosen if there is a mix of reply contents that include at least one of the default encodings.
- json/decode is called twice with clj-http if api operation.response.content is "*/*" HOT 2
- Ability to be used as a general parser HOT 3
- Patching schema after bootstrap HOT 4
- $ref is not working properly for swagger parameters HOT 1
- `wrap-default` in CLJS causes compiler warning HOT 1
- Applying interceptors to `bootstrap-openapi` HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from martian.