Skip to content

Please point me on how to add new collection types (e.g. Vavr / Guava) #712

@domdorn

Description

@domdorn

I'm trying to add the collection types ( Option, List, Tuple, etc.) from the vavr-library, but can't seem to find where to plug them in (https://www.vavr.io/vavr-docs/).
I already figured out on how to make the Future type work here https://dominikdorn.com/2020/05/spring-doc-openapi-swagger-vavr-future/
but I'm a little lost on how to make the collections types work.
It would be great if you could point me in the right direction!

This is what I tried so far:

  1. I've already tried creating a io.swagger.v3.core.converter.ModelConverter but this leads to NPEs when swagger tries to clone the schema.
  2. I also tried SpringDocUtils.getConfig().replaceWithClass(io.vavr.control.Option.class, java.util.Optional.class); but this seems to be unable to handle generics.
  3. I tried to register the VavrModule with the ObjectMapper of SpringDoc/Swagger, but this also doesn't help ( Json.mapper().registerModule(new VavrModule()); )

Thx,
Dominik

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions