Skip to content

Commit e02109f

Browse files
committed
feat: add OpenAPI documentation with swagger-jsdoc
- Add swagger-jsdoc for auto-generating OpenAPI spec from JSDoc comments - Create swagger.config.ts with base schemas and security setup - Add JSDoc comments to Business router endpoints (getCatalog, getCollections) - Setup swagger-ui at /docs endpoint - Add /openapi.json endpoint for raw spec access - Add npm script 'openapi:generate' to generate static spec - Generate initial openapi.json with Business endpoints Access: - Swagger UI: http://localhost:8080/docs - OpenAPI JSON: http://localhost:8080/openapi.json
1 parent 5499b7b commit e02109f

7 files changed

Lines changed: 793 additions & 1 deletion

File tree

openapi.json

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
{
2+
"openapi": "3.0.0",
3+
"info": {
4+
"title": "Evolution API",
5+
"version": "2.3.7",
6+
"description": "WhatsApp API - OpenAPI Documentation",
7+
"contact": {
8+
"name": "Evolution API",
9+
"url": "https://github.com/EvolutionAPI/evolution-api"
10+
}
11+
},
12+
"servers": [
13+
{
14+
"url": "/v1",
15+
"description": "API v1"
16+
}
17+
],
18+
"components": {
19+
"securitySchemes": {
20+
"apikey": {
21+
"type": "apiKey",
22+
"name": "apikey",
23+
"in": "header",
24+
"description": "API key for authentication"
25+
}
26+
}
27+
},
28+
"security": [
29+
{
30+
"apikey": []
31+
}
32+
],
33+
"paths": {
34+
"/business/getCatalog/{instanceName}": {
35+
"post": {
36+
"tags": [
37+
"Business"
38+
],
39+
"summary": "Get WhatsApp Business catalog",
40+
"description": "Fetches all products from a WhatsApp Business catalog with automatic pagination",
41+
"security": [
42+
{
43+
"apikey": []
44+
}
45+
],
46+
"parameters": [
47+
{
48+
"in": "path",
49+
"name": "instanceName",
50+
"required": true,
51+
"schema": {
52+
"type": "string"
53+
},
54+
"description": "Instance name"
55+
}
56+
],
57+
"requestBody": {
58+
"required": true,
59+
"content": {
60+
"application/json": {
61+
"schema": {
62+
"$ref": "#/components/schemas/CatalogRequest"
63+
}
64+
}
65+
}
66+
},
67+
"responses": {
68+
"200": {
69+
"description": "Catalog retrieved successfully",
70+
"content": {
71+
"application/json": {
72+
"schema": {
73+
"$ref": "#/components/schemas/CatalogResponse"
74+
}
75+
}
76+
}
77+
},
78+
"400": {
79+
"description": "Bad request",
80+
"content": {
81+
"application/json": {
82+
"schema": {
83+
"$ref": "#/components/schemas/ErrorResponse"
84+
}
85+
}
86+
}
87+
}
88+
}
89+
}
90+
},
91+
"/business/getCollections/{instanceName}": {
92+
"post": {
93+
"tags": [
94+
"Business"
95+
],
96+
"summary": "Get WhatsApp Business collections",
97+
"description": "Fetches all collections with their products from a WhatsApp Business account",
98+
"security": [
99+
{
100+
"apikey": []
101+
}
102+
],
103+
"parameters": [
104+
{
105+
"in": "path",
106+
"name": "instanceName",
107+
"required": true,
108+
"schema": {
109+
"type": "string"
110+
},
111+
"description": "Instance name"
112+
}
113+
],
114+
"requestBody": {
115+
"required": true,
116+
"content": {
117+
"application/json": {
118+
"schema": {
119+
"$ref": "#/components/schemas/CollectionsRequest"
120+
}
121+
}
122+
}
123+
},
124+
"responses": {
125+
"200": {
126+
"description": "Collections retrieved successfully",
127+
"content": {
128+
"application/json": {
129+
"schema": {
130+
"$ref": "#/components/schemas/CollectionsResponse"
131+
}
132+
}
133+
}
134+
},
135+
"400": {
136+
"description": "Bad request",
137+
"content": {
138+
"application/json": {
139+
"schema": {
140+
"$ref": "#/components/schemas/ErrorResponse"
141+
}
142+
}
143+
}
144+
}
145+
}
146+
}
147+
}
148+
},
149+
"tags": []
150+
}

0 commit comments

Comments
 (0)