ring-swagger & compojure-api
borkdude 2019-01-15T12:05:06.035900Z

Since some Metosin people hang out here, I’ll post this here as well: Is there a JSON library which lets you only read what you need from a JSON string, to save performance? Like what you would do when writing your own JSON deserializer for a type in e.g. Java or Haskell. Maybe it could be done with jsonista?

ikitommi 2019-01-15T12:20:49.041200Z

@borkdude jsonista uses Jackson and exposes the ObjectMapper. If that can be used to do it, then yes. You might need to use jackson-core and it’s streaming reads.

ikitommi 2019-01-15T12:21:46.042600Z

jsonista doesn’t have a streaming api now, PR most welcome if you want to create one.

borkdude 2019-01-15T12:21:52.042800Z

it would be a nice feature to be able to give it something like a Schema or spec-like thing and it would do it for you. I understand it’s currently not there, but could be useful, since jsonista focuses on performance.

ikitommi 2019-01-15T12:22:48.043700Z

yes, it would be nice. you can strip away the extra keys now in two steps (jsonista + spec-tools), but it does extra things and is slower.

ikitommi 2019-01-15T12:24:24.045Z

with the upcoming select in spec, one could create a jackson deserializer out of the definition.

ikitommi 2019-01-15T12:26:50.047200Z

hmm… actually, as the spec visitor is already ready, one could write a spec->FunctionalSerializer transformer and create an ObjectMapper out of that - should be fast. not sure if all the relevant context is available in the Jackson databind pipeline for it.

ikitommi 2019-01-15T12:28:22.048300Z

e.g. for nested maps/vectors, one needs to know how deep we are.

ikitommi 2019-01-15T12:28:59.048900Z

I guess there is enough context while parsing as the nested Java classes work.


does anyone know if its possible to just upgrade ring-swagger-ui on compojure-api 1.1.x?


an initial test of just pulling in the latest 3.41.1 version to a compojure-api 1.1.x project doesn't seem to work


oh i guess ring-swagger is only targeting swagger 2.0 anyway

ikitommi 2019-01-15T16:05:53.054100Z

@nickmbailey yes, only 2.0. there are open issues in both spec-tools & schema-tools for the OpenApi3 support. Happy to help if someone wants to start doing those.


got it


@ikitommi it looks like the newer versions of swagger-ui still support openapi 2 though


i was confused, i really just want a newer version of the UI not support for openapi3

ikitommi 2019-01-15T17:18:19.056600Z

@juhoteperi might know how the ring-swagger supports the new UIs. I think the lates ring-swagger should support both.


ok i don't know what i was doing wrong earlier but upgrading ring-swagger and ring-swagger-ui manually in my deps list worked


i think earlier i only manually upgraded ring-swagger which gave me an old version of ring-swagger-ui still since compojure-api explicitly depends on the ui piece


so you have to manually upgrade both