-
-
Notifications
You must be signed in to change notification settings - Fork 48
Open
Description
Would like to first say that I love the library, great work.
I am generating an OpenAPI spec using reitit and malli.
One of the specs I am using is :time/local-date.
When it is referred to in a schema, it has "$ref": "#/components/schemas/time~1local-date", where the slash is encoded as ~1.
When I call martian-http/bootstrap-openapi, it fails with
clojure.lang.ExceptionInfo: Cannot find reference {:reference "#/components/schemas/time~1local-date"} (schema.cljc:89)
I have been using the following workaround in Martian in order to get this to work. The only difference is that I am calling decode-ref after splitting by slash.
(defn decode-ref [s] (string/replace s "~1" "/"))
(defn lookup-ref
"Patch of `martian.schema/lookup-ref`. Calls `decode-ref` to convert ~1 to /"
[ref ref-lookup]
(if (string/starts-with? ref "#/")
(or (get-in ref-lookup (drop 1 (map (comp keyword decode-ref) (string/split ref #"/"))))
(throw (ex-info "Cannot find reference"
{:reference ref})))
(throw (ex-info "Non-local references are not supported yet. References should start ref with '#/'"
{:reference ref}))))
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels