Rest API restrict the view of the data model

I’m using the REST API add-on in a large application with many entities. The URL /rest/v2/docs/swaggerDetailed.yaml provides information about all entities in the application.
I would like to restrict the view of the data model so that only necessary information is provided in swaggerDetailed.yaml. How can I do this?

I’ve already tried to hide endpoints from Swagger. But it didn’t work:

Does anyone know a solution?


the swaggerDetailed.yaml file is generated by the com.haulmont.addon.restapi.api.swagger.SwaggerGeneratorBean bean. You may override the bean in you project and implement any behavior in the overriden bean.

Keep in mind that you must register the new bean in the rest-spring-dispatcher-spring.xml file, not in the regular web-spring.xml file. You find an example in this topic.

1 Like