-
Notifications
You must be signed in to change notification settings - Fork 57
Description
Hi,
I'm trying to generate documentation, but something is wrong.
I have created a repository, where you can see my implementation. I'm using the same project structure/configuration as in the prepared repository. Feel free to "play around" with prepared case.
The link to a repository is here -> https://github.com/perfringis/swagger-test-repo
In the case of Server.loadServices
In my app.js file as you can see. I'm trying to use Server.loadServices(router, 'controllers/*', __dirname);
The swagger config file looks as follows:
{
"swagger": {
"basePath": "",
"outputDirectory": "./dist",
"entryFile": "./src/controllers/index.ts",
"produces": ["application/json"],
"ignore": ["**/node_modules/**"]
}
}The index.ts file in the controllers directory looks as follows:
export * from './hello-world.controller';The hello-world.controller.ts is a just simple class implementation.
After that, I'm trying to generate documentation by running the npm/yarn run swagger command.
After running the command. Prepared swagger.json looks as follows:
{
"basePath": "",
"definitions": {},
"info": {
"license": {
"name": "MIT"
},
"title": "swagger-test-repo",
"version": "1.0.0"
},
"paths": {},
"swagger": "2.0",
"securityDefinitions": {},
"produces": [
"application/json"
]
}Looks like in the paths property, there is no information about my controllers.
In the case of Server.buildServices
This implementation is slightly different.
In app.js file, I'm using import Controllers from './controllers'; and Server.buildServices(router, ...Controllers);.
The swagger config file looks as follows:
{
"swagger": {
"basePath": "",
"outputDirectory": "./dist",
"entryFile": "./src/controllers/index.ts",
"produces": ["application/json"],
"ignore": ["**/node_modules/**"]
}
}The index.ts file in the controllers directory looks as follows:
import { HelloWorldController } from './hello-world.controller';
export default [HelloWorldController];The hello-world.controller.ts is a just simple class implementation.
After that, I'm trying to generate documentation by running the npm/yarn run swagger command.
After running the command. Prepared swagger.json looks as follows:
{
"basePath": "",
"definitions": {},
"info": {
"license": {
"name": "MIT"
},
"title": "swagger-test-repo",
"version": "1.0.0"
},
"paths": {},
"swagger": "2.0",
"securityDefinitions": {},
"produces": [
"application/json"
]
}In both cases, generated swagger.json don't contain any information about my controllers.
In the controller class, I have added @Tags('Hello World') for experiments. But it doesn't work either.
Maybe in my configuration is something wrong. If yes, could you prepare a small example of how to correct it? I will be very grateful. Thanks in advance.