Fork me on GitHub
#ring-swagger
<
2019-01-15
>
borkdude12:01:06

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?

ikitommi12:01:49

@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.

ikitommi12:01:46

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

borkdude12:01:52

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.

ikitommi12:01:48

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.

ikitommi12:01:24

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

ikitommi12:01:50

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.

ikitommi12:01:22

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

ikitommi12:01:59

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

nickmbailey15:01:40

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

nickmbailey15:01:48

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

nickmbailey15:01:32

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

ikitommi16:01:53

@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.

nickmbailey16:01:28

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

nickmbailey16:01:00

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

ikitommi17:01:19

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

nickmbailey20:01:40

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

nickmbailey20:01:28

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

nickmbailey20:01:38

so you have to manually upgrade both

👌 5