-
-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
martian-re-frame martian instance has empty :handlers
#93
Comments
Hi, Thanks for letting me know. It sounds like there are possibly two issues here - the first problem relating to disjoin and the second with having no handlers (which very much sounds like a failed bootstrap). The readme should be updated so that it doesn't guide you into repeating the error in #57, as well - I will update that. There were some reasonably big changes regarding OpenAPI in the latest release and it's possible a mistake was made. Could you try 0.1.12 if possible to see if it worked then? Many thanks |
Hi, I've updated the example in the readme and ensured it works. Part of this was updating the example Swagger server, https://pedestal-api.herokuapp.com/, to allows cross origin requests. You should be able to do this in a REPL: (martian/init "http://pedestal-api.herokuapp.com/swagger.json")
(martian.core/explore @(re-frame/subscribe [::martian/instance]))
;; => [[:all-pets Get all pets in the store] [:create-pet Create a pet] [:get-pet Get a pet by id] [:update-pet Update a pet] [:delete-pet Delete a pet by id]] |
Just checking to see whether I'm running up against an issue patterned after #58 , seems like I am. All the documents I tested (as noted above) were served as Still receiving the uncaught error regarding |
Much obliged. Cursory experimentation shows that martian-re-frame 0.1.12 appears to exhibit the same behavior regarding whether |
The |
Yes, material changes in OpenAPI 3... What I am attempting to do here is to consume an OpenAPI 3.0.1 JSON document with martian, but have found that parameters are not being recognized at all. This seems to be implicated in whatever is causing the Using |
Sample OpenAPI def and REPL session: {
"openapi": "3.0.1",
"info": {
"title": "My API",
"version": "1"
},
"paths": {
"/project/{projectKey}": {
"get": {
"summary": "Get specific values from a configuration for a specific project",
"operationId": "getProjectConfiguration",
"parameters": [
{
"name": "projectId",
"in": "path",
"description": "Project ID",
"required": true,
"schema": {
"type": "string",
"format": "string"
}
},
{
"name": "key",
"in": "query",
"description": "Obtains values corresponding to these keys from a project's configuration",
"schema": {
"type": "string",
"format": "string"
}
}
],
"responses": {
"200": {
"description": "Configuration for the specified project",
"content": {
"application/json": {
"schema": {
"type": "string",
"format": "string"
}
}
}
},
"403": {
"description": "Refusing access to requested resource, perhaps due to insufficient privilege"
},
"404": {
"description": "Requested resource was not found"
}
}
}
} In
|
Tried converting the OpenAPI 3 doc to Swagger 2 and directing martian to use that Swagger 2 output, and it seems to function correctly ^_^ me $ api-spec-converter --from=openapi_3 --to=swagger_2 --syntax=json ./src/api.json In
|
So one thing I draw from this exercise is that either my OpenAPI document, while other tooling and the online validators are satisfied with it, requires a little more refinement in order to satisfy martian's needs, or, perhaps martian requires a little more TLC with regard to parsing OpenAPI 3 as you had mentioned.. |
Hi, Thank you so much for such a detailed investigation. The OpenAPI stuff is very new and I would imagine the issue lies there. Thanks for the small reproducible case - that really helps. Martian should be able to cope with any valid schema, with the one caveat about operation-ids. |
Hi, There was indeed a mistake, I have pushed |
I can confirm |
Using martian-re-frame 0.1.13 and friends. The code sample in the martian-re-frame documentation fails with
Uncaught Error: No protocol method ISet.-disjoin defined for type cljs.core/List: ([:my-operation-id {... params ...} :http-success :http-failure])
. I noted issue #57 and now have martian initialization completing before performing a re-frame dispatch, but that still results::http-failure
being called with:unknown-route
followed by the aforementioned error.Inspecting the martian value in re-frame's
app-db
reveals that the:handlers
key holds a blank seq. Wondering if this could be source of trouble, I tried feedingmartian.re-frame/init
various swagger json documents, such as ones from the official examples repo, our own that we have on hand here, andmartian/core/test-resources/swagger.json
andmartian/core/test-resources/swagger.json
. Every document resulted in an empty:handlers
. The:base-url
changes appropriately, and the:interceptors
seem to contain everything that it should, but:handlers
is conspicuously empty. This is the case in Firefox and Google Chrome.At the Clojure-based lein repl, these JSON files uniformly produce a perfectly usable martian, just as advertised, and
:handlers
is flush with the correct entries. Also, martian's own re-frame test suitecd re-frame && lein test
passes 100%. I ran the test suite with the dependency versions inproject.clj
as tagged in martianv0.1.13
and also separately with the versions we are using here.The text was updated successfully, but these errors were encountered: