Swagger shows wrong id field using Spring Data Rest

I am using Spring Boot + Spring DATA REST and Swagger (Springfox 2.7.0). Spring DATA REST follows the HATEOAS principles, so the id field should never be present in return resources. In GET methods this works fine, but in POST methods the form shows an id parameter. I don't understand where it came from.

This is a screenshot of the Swagger ui. As you can see, the form contains a type path id parameter that is not present in the model definition.

I'm pretty sure it's not needed, actually makes a request through Postman, it works without setting id param. Also in swagger everything works fine, filling the id param with a random value.

Is this an incompatibility between Spring DATA REST and Swagger, or should I install something else? I followed the instructions below: http://springfox.github.io/springfox/docs/current/#support-for-spring-data-rest

enter image description here

==================== UPDATE ============================= ================================= ===

This issue is resolved in SpringFox version> 2.7.0. Here's a link to the bug: https://github.com/springfox/springfox/issues/1839

+3


source to share





All Articles