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

ModelAttribute does not resolve fields without @JsonProperty #448

Closed mustaphazorgati closed 3 years ago

mustaphazorgati commented 3 years ago

Hey there!

We have found our that our documentation is incomplete. All fields without the @JsonProperty annotation are not there (anymore).

It seems to be that the ObjectWriter in the FieldDocumentGenerator#generateDocumentation(Type[], TypeFactory), line 103 writer.acceptJsonFormatVisitor(type, visitorWrapper); doesn't visit those fields.

Is this is configuration problem with the ObjectMapper? If yes, a configuration problem on your side or on our side?

Btw: The ModelAttributeSnippet is missing a toggle for failOnUndocumentedFields

jmisur commented 3 years ago

Try playing around with ObjectMapper's visibility modifier. We do setup special config for our sample projects.

mustaphazorgati commented 3 years ago

Thanks mate! That worked!

mustaphazorgati commented 3 years ago

Btw: The ModelAttributeSnippet is missing a toggle for failOnUndocumentedFields

I've created a very small PR introducing that toggle.