malli

https://github.com/metosin/malli :malli:
Hankstenberg 2020-12-07T07:07:14.198200Z

Yea, I know and I'm loving it. I'd like to experiment a bit with API-Driven development at our company. OpenApi is nice, but who wants to write JSON/YAML by hand when you can write edn instead and programmatically create JSON Schema and OpenAPI-Specs from that. The JSON Schema part is covered nicely by malli, which is wonderful, because we can utilize the nice ecosystem that uses JSON Schema already AND have the power of property-based testing. But what about speccing the endpoints? There is spec-tools, but spec-tools uses clojure.spec instead of malli. I imagine that I could e.g. specify an "Order" schema and a "Processed Order" schema in order to specify an entity and an entity in a certain state (with "processed" set to "true" and a "processed-on" field set to some date and so on. With the ability to even spec functions with malli, we have all the building blocks to extend malli's capabilities to also specify the actual API: (def =>process-oder [:=> [:tuple entities/order events/process-order] entities/processed-order]) Now all that's missing is to map this to e.g. a POST request and generate a complete openapi-spec from it (schema+end points), so that e.g. a REST-Client can be generated from this code. At least that's how I would imagine it. Maybe I'm on the wrong track here, though.

ikitommi 2020-12-07T07:36:45.198600Z

have you looked at reitit-malli? here’s an example: https://github.com/metosin/reitit/tree/master/examples/ring-malli-swagger

Hankstenberg 2020-12-07T08:59:15.198800Z

That's the best possible reply. Yes, there already is something and btw it's even better than what you had in mind. Thanks a bunch! 👍