This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-29
Channels
- # announcements (13)
- # aws-lambda (19)
- # babashka (11)
- # beginners (90)
- # calva (35)
- # chlorine-clover (16)
- # cider (8)
- # clj-kondo (6)
- # cljsrn (10)
- # clojure (44)
- # clojure-australia (1)
- # clojure-europe (35)
- # clojure-nl (6)
- # clojure-norway (7)
- # clojure-uk (101)
- # clojurescript (79)
- # community-development (40)
- # conjure (1)
- # contributions-welcome (4)
- # core-logic (2)
- # cursive (6)
- # datomic (4)
- # figwheel-main (5)
- # fulcro (18)
- # girouette (1)
- # graalvm (3)
- # hoplon (2)
- # hugsql (2)
- # jobs (5)
- # malli (26)
- # off-topic (74)
- # pathom (36)
- # portal (4)
- # reagent (10)
- # reitit (23)
- # remote-jobs (1)
- # shadow-cljs (27)
- # spacemacs (10)
- # sql (3)
- # startup-in-a-month (6)
- # tools-deps (55)
- # vim (11)
- # xtdb (15)
Bună dimineaţa!
Yesterday, I spent a lot of my time in Kotlin, fighting with Jackson to ensure that the data I'm reading from an external API fits into the statically defined model...
Raise a feature request with JetBrains for ctrl-alt-shift-k to do Clojure -> Kotlin, as well as Java -> Kotlin
My data model in Kotlin (this isn't a fault of Kotlin per-se!) is littered with`@Json*` annotations...
It doesn't help that the external party's API, obviously done using C#
is PascalCase for the field names
morning
PascalCase :face_vomiting: … I feel your pain. Forcing crappy JSON to map onto classes correctly in a statically typed language is the hardest problem in computer scient.
apart from the other problem of cache invalidation and off-by-one errors
also if you work in a microservice style and a different team has a json api with streetAddress
but your team is using street_address
lolol
isn't there a library for this, camel_Snake-kebab or something?
in clj yes
not sure about other langs
does rely on consistency though >_>
ah, so no use in the real world then!
Yep sadly
I up you with Proto/Flat Buffers
Does anyone have an opinion on malli vs spec?
I've joined a new codebase and there's spec, plumatic schema and malli
so I think we should settle on one
I use malli a lot. I use reitit to service a RESTful API and malli is soooooooo good.
I imagine the plan is to settle on spec once it's out of alpha...
unless everyone on the project retires before it happens
somebody sell me malli, i've had a lot of success with plumatic/schema in the past
for example, with malli and reitit I was able, without hardly any work, to expose a Swagger endpoint.
is swagger useful?
it seems clever but I've never seen the benefit (I can well believe that there is one though)
But, having it done for me is nice, I don't have to spend a lot of cycles working with it,
I'm being pushed to make swagger work too, but it makes more sense for us because we have outsourced the UI and mobile app
At one point I was going to add it because yada apparently made it easy - but there never seemed enough reason to actually do it.
but having tried to read through the 15,000 word openapi3 spec yesterday my brain is mush
wow that's clever
how is the rest of the document constructed?
it looks really good
you have a base template and hooks that the unit tests spit their snippets out into
yeah I was hoping we could somehow kill two birds with one stone with tests and documentation
===== Example 1 (Successful BASIC Authentication)
====== Request Headers
include::{snippets}/authentication-basic/request-headers.adoc[]
====== Example HTTPie Request
include::{snippets}/authentication-basic/httpie-request.adoc[]
something like swagger makes sense when you generate code/validators/types from the spec, as well as documentation. I've used it a couple of times as just the docs part, and it makes no sense to me
I guess you could do that pretty easily with martian and an interceptor: https://github.com/oliyh/martian cc @U051H1KL1
What’s the advantage of using tests over swagger? Keeping you honest?
haha, something like that
swagger is good
i see it as docs for free
this looks really great, how do these annotations work @dharrigan ? Is that an asciidoc thing?
and right now in a project where we have to field a bunch of questions about what is what and where and why, i'm just like 'ugh, this should be automated'
that said if i had to write swagger by hand, i'd nope out
.JSON Error Response Format
{
"code": "errorCode", <1>
"errors": {
"request": [ <2>
"Sorry, incorrect data [foo] supplied for [field]. Reason [bar]." <3>
]
}
"message": "Sorry, there has been a validation problem with the supplied data. Please report the reference code to Support.",
"reference": "referenceCode" <4>
}
<1> For example `E13000`.
<2> For example `eligibilityCheckRequest`.
<3> For example `Sorry, incorrect data [123456789012345678] supplied for field [vin]. Reason [size must be between 0 and 17]."`
<4> For example `4f35fc4f
`I see nice. And ascii doc does the structure / index too? (I've not used it before)
Very cool
So you write the overall template by hand and include references to files that are spit out by the unit tests. So each time you add a new unit test, you add a bit on to your main template, too?
I used hydrox before, http://helpshift.github.io/hydrox/ but I think zcaudate left the clojure community in storm and fire
but that's for clojure tests
I wonder how much work it would be to do something like spring restdocs
malli gives you jsonschema in your swagger doesn't it @dharrigan? or am i having a false memory? lack of jsonschema (for complex content) was always a shortcoming with the swagger autogenerated from yada schema annotations
openapi3 is both a superset and a subset of json schema (apparently)
haha maybe I don't mean superset and subset
how do you call it when there are properties in openapi3 that are not in json schema, and properties in json schema that are not in openapi3