I am following the instruction from https://swagger.io/specification/ to generate a Swagger spec from my code. My project is comprised of several services, and I have a root folder which has a couple of workspaces in it (I have a workspace for each service). Inside the root folder there is only a go.work file, specifying the path to each workspace. The structure of my project is as follows:
myworkspaceRoot/
├── go.work
├── go.work.sum
├── Subfolder
├──── workspace1/
│ ├── go.mod
│ └── ...
├──── workspace2/
│ ├── go.mod
│ └── ...
└──── workspace3/
├── go.mod
└── ...
Each workspace is a unique service with its own main file and dependencies. I managed to generate the Swagger spec files for each workspace individually, but I want to generate a new spec file which contains the documentation for all of the system. Is it possible to do this with my current settings? Since Go-Swagger starts from a file and scans every path (If I am not mistaken) my first idea was to create a main file in the root folder and import all of the packages, but this was of course futile as I was given the error that main was redeclared in the package(which I think can be solved by separating each directory but that does not suit my project).
Consequently, If I just run the swagger generate spec -o swagger.yml --scan-models
command on the root folder without anything extra, it generates an empty swagger.yml file as expected.
The second option is always to write a script which combines all of the generated specs for individual services, but I was looking for a more intuitive answer, if one exists.