ScaCap / spring-auto-restdocs

Spring Auto REST Docs is an extension to Spring REST Docs
https://scacap.github.io/spring-auto-restdocs/
Apache License 2.0
311 stars 86 forks source link

Expand Map automatically #283

Closed unlimitedsola closed 4 years ago

unlimitedsola commented 5 years ago

for example:

If we have the following domain class:

data class Embedded(val foo:String, val bar:Int)
data class MyDomain(val name:String, val map:Map<String,Embedded>)

We can document MyDomain class with following json paths.

It would be nice if Maps can be expanded because its possible to map the domain class above in JPA

jmisur commented 5 years ago

How is this currently shown with SARD? Would you like to submit a PR, at least with an example for us to see how it behaves?

unlimitedsola commented 5 years ago

How is this currently shown with SARD?

Currently, it only shows the documentation for the map property with the type being Map, neither its key nor value gets expanded.

Would you like to submit a PR, at least with an example for us to see how it behaves?

I'd like to submit a PR for this but unfortunately I'm busy at work at present.

What's your opinion for having following documenting entries in our fields table of MyDomain object above?

these should cover all documentable locations for properties

jmisur commented 5 years ago

The reason why we didn't implement Map is because it's not possible to determine it's contents statically. It can contain different elements in different situations, therefore it is preferred to be documented manually (custom asciidoc) or you can use existing facilities which allows you to put a documentation class in place of the result. See example or documentation.

jmisur commented 4 years ago

Closing because issue has a workaround.