This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
I have a react form that has a input :type "date" and the stored value is a string "2022-08-01". How to check for valid date in malli with clojurescript ?
{:info {:title "Site Map"},
:paths {"" {:get {:parameters {:query {:type "object",
:properties {:email {:type "string"}}},
:path {:type "object",
:properties {:uuid {:type "string",
:format "uuid"}},
:required [:uuid]},
:formData {:type "object",
:properties {}}},
:responses {403 {:description "User tried to access something their not allowed to",
:custom/template "mvp/error_pages/403.html"},
401 {:description "Bad Auth/Cookie gets a redirect to login"}},
:produces ("text/html")},
:post {:parameters {:query {:type "object",
:properties {:email {:type "string"}}},
:path {:type "object",
:properties {:uuid {:type "string",
:format "uuid"}},
:required [:uuid]},
:formData {:type "object",
:properties {:email {:type "string"},
:otp {:type "array",
:items {:type "integer",
:format "int64"}}},
:required [:email :otp]}},
:responses {403 {:description "User tried to access something their not allowed to",
:custom/template "mvp/error_pages/403.html"},
401 {:description "Bad Auth/Cookie gets a redirect to login"}},
:produces ("text/html"),
:consumes ("multipart/form-data")}},
"/login3{uuid}" {}},
:basePath "/swagger"}
this is what i'm giving itMaybe thread this discussion?
i'm using https://github.com/metosin/ring-swagger maybe this doesn't work anymore? (it's pretty old). i looked at some of the tests and my swagger objects look pretty similar to the ones in the tests. i get complaints from swagger-json
fn saying it doesn't know how to convert my object
into a swagger schema
looking at swagger's docs https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject i think malli.swagger is generating wrong data
Currently it produces OpenAPI 2.x https://github.com/metosin/malli#swagger2
well, malli.swagger output is throwing errors for the other library for swagger that metosin made. i don't know what to do
{
"skipParam": {
"name": "skip",
"in": "query",
"description": "number of items to skip",
"required": true,
"type": "integer",
"format": "int32"
},
"limitParam": {
"name": "limit",
"in": "query",
"description": "max records to return",
"required": true,
"type": "integer",
"format": "int32"
}
}
it's not outputting this style of objectI'm not sure if Tommi has intended that malli.swagger
should play along with ring-swagger
I don't also understand why would both be needed. AFAIK they both generate swagger.json
Difference being that ring-swagger
can generate the json from plumatic schema / clojure.spec and malli.swagger
does that for malli schemas
Uhhhmm.. Need to correct myself. Looks like malli.swagger
produces "chunks" of swagger 2.0 compatible JSON, not the complete swagger doc.
it makes sense that malli swagger wouldn't produce the whole swagger doc, i just don't know what to do with it's output
Which kinda makes sense since Malli knows only about the shape of data. It doesn't know anything about route definitions and other stuff that goes into swagger spec
Yeah, I see. I don't know how Yada swagger works but in reitit it works so that it constructs the full swagger.json
from route data + schema definitions. For schemas it supports plumatic, clojure.spec and malli.. And when it's constructing the swagger, it checks which impl it is, generates the needed JSON chunks and places them into the swagger doc
Yeah.. I'm trying to look if ring-swagger
has extension points where you could jack in malli
i think i just have to change the params code, i already have merged route + method params
i just don't know what to change the params to, seems like i need to build ref structures and flatten out nested maps or something
Swagger is specifically pre-OpenAPI, which does get confusing. The name change and a whole bunch of backwards breaking changes happened with the release of OpenAPI 3.0, so a good mental note is that you really shouldn’t expect one from another. This isn’t necessarily very helpful to the issue at hand, but still an unfortunate detail one should be aware of.