REST Swagger for domain model

I have a requirement to develop an Android application with Cuba Platform as the back end. I would like to be able to use Swagger CodeGen to generate a client for my domain model and have a tightly coupled contract between client and server.

When I use CodeGen on the Cuba Platform Swagger interface, I only get a contract for the platform contract and nothing for my domain model.

As I see it (unless I am missing something), I currently have two choices:

  1. Hand code the client contract.
  2. Create a Custom REST controller and use something like SpringFox to document my api which can then be used by CodeGen.

Both of these options are problematic for me as I want my Android build to fail if the contract is not not valid because of a schema change. This is also way too much work especially when the framework has the capability and this could be automatic.

What I was expecting was the Swagger to include my Entities and Services so that I can use a code generation tool to scaffold a strongly typed proxy object. This also allows the use of IDE features such as code completion and compile time checking.

Is there some magic sauce/configuration/tool that allows me to generate Swagger/proxies for my domain model or am I on my own?

Thanks!

Hello, @ielbury4088

we’ve already started to work on this task. Please take a look at an issue in YouTrack: link.

Regards,
Daniil.

Awesome! I look forward to this feature it’s going to save a LOT of time.