Skip to content

Commit a648531

Browse files
authored
Refactor openapi.yaml (#332)
* format and adding variable server URL * removed requestBody from GET all boards * add CORS support for api-reference * refactor and add authorization * remove request body for 'POST /auth/email/verify' * fix
1 parent 0958939 commit a648531

File tree

2 files changed

+54
-89
lines changed

2 files changed

+54
-89
lines changed

content/api-reference/openapi.yaml

Lines changed: 49 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,18 @@ info:
1313
name: CodeCarrot
1414
1515
servers:
16-
- url: https://api.<your-domain>.com/api/v1
17-
description: ""
16+
- url: '{protocol}://{host-with-port}/api/v1'
17+
description: "API URL"
18+
variables:
19+
protocol:
20+
enum:
21+
- 'http'
22+
- 'https'
23+
default: 'http'
24+
host-with-port:
25+
default: 'localhost:8000'
26+
security:
27+
- bearerAuth: []
1828
tags:
1929
- name: auth
2030
description: "Endpoints related to account authentication via email and password"
@@ -32,7 +42,6 @@ tags:
3242
description: "Endpoints related to roles and permissions"
3343
- name: settings
3444
description: "Endpoints related to LogChimp settings"
35-
3645
paths:
3746
/auth/login:
3847
post:
@@ -41,13 +50,10 @@ paths:
4150
summary: Login
4251
description: 'Login to account using email and password.'
4352
operationId: userSignin
44-
parameters:
45-
- $ref: '#/components/parameters/contentTypeJson'
46-
- $ref: '#/components/parameters/origin'
4753
requestBody:
4854
$ref: '#/components/requestBodies/Login'
4955
responses:
50-
200:
56+
'200':
5157
description: ''
5258
content:
5359
application/json:
@@ -60,7 +66,7 @@ paths:
6066
headers:
6167
Content-Type:
6268
$ref: '#/components/headers/contentTypeJson'
63-
400:
69+
'400':
6470
description: Bad Request
6571
content:
6672
application/json:
@@ -90,7 +96,7 @@ paths:
9096
headers:
9197
Content-Type:
9298
$ref: '#/components/headers/contentTypeJson'
93-
500:
99+
'500':
94100
$ref: "#/components/responses/InternalServerError"
95101
headers:
96102
Content-Type:
@@ -103,13 +109,10 @@ paths:
103109
summary: Sign up
104110
description: Create a new user account.
105111
operationId: userSignup
106-
parameters:
107-
- $ref: '#/components/parameters/contentTypeJson'
108-
- $ref: '#/components/parameters/origin'
109112
requestBody:
110113
$ref: '#/components/requestBodies/Login'
111114
responses:
112-
201:
115+
'201':
113116
description: ''
114117
content:
115118
application/json:
@@ -122,7 +125,7 @@ paths:
122125
headers:
123126
Content-Type:
124127
$ref: '#/components/headers/contentTypeJson'
125-
400:
128+
'400':
126129
description: Bad Request
127130
content:
128131
application/json:
@@ -150,24 +153,21 @@ paths:
150153
headers:
151154
Content-Type:
152155
$ref: '#/components/headers/contentTypeJson'
153-
500:
156+
'500':
154157
$ref: "#/components/responses/InternalServerError"
155158
headers:
156159
Content-Type:
157160
$ref: '#/components/headers/contentTypeJson'
158-
security: [ ]
161+
security: []
159162
/auth/setup:
160163
get:
161164
tags:
162165
- auth
163166
summary: Site setup
164167
description: 'Get site setup information.'
165168
operationId: getSiteSetup
166-
parameters:
167-
- $ref: '#/components/parameters/contentTypeJson'
168-
- $ref: '#/components/parameters/origin'
169169
responses:
170-
200:
170+
'200':
171171
description: ''
172172
content:
173173
application/json:
@@ -180,7 +180,7 @@ paths:
180180
headers:
181181
Content-Type:
182182
$ref: '#/components/headers/contentTypeJson'
183-
500:
183+
'500':
184184
$ref: "#/components/responses/InternalServerError"
185185
headers:
186186
Content-Type:
@@ -192,9 +192,6 @@ paths:
192192
summary: Site setup
193193
description: 'Setup the site by creating the owner account.'
194194
operationId: siteSetup
195-
parameters:
196-
- $ref: '#/components/parameters/contentTypeJson'
197-
- $ref: '#/components/parameters/origin'
198195
requestBody:
199196
description: ''
200197
content:
@@ -213,7 +210,7 @@ paths:
213210
example: "Mike"
214211
required: true
215212
responses:
216-
200:
213+
'200':
217214
description: ''
218215
content:
219216
application/json:
@@ -226,7 +223,7 @@ paths:
226223
headers:
227224
Content-Type:
228225
$ref: '#/components/headers/contentTypeJson'
229-
400:
226+
'400':
230227
description: Bad Request
231228
content:
232229
application/json:
@@ -254,7 +251,7 @@ paths:
254251
headers:
255252
Content-Type:
256253
$ref: '#/components/headers/contentTypeJson'
257-
500:
254+
'500':
258255
$ref: "#/components/responses/InternalServerError"
259256
headers:
260257
Content-Type:
@@ -292,15 +289,8 @@ paths:
292289
type: string
293290
default: application/json
294291
description: ""
295-
requestBody:
296-
description: Get all the boards
297-
content:
298-
application/json:
299-
schema:
300-
type: object
301-
required: false
302292
responses:
303-
200:
293+
'200':
304294
description: ""
305295
content:
306296
application/json:
@@ -315,12 +305,12 @@ paths:
315305
headers:
316306
Content-Type:
317307
$ref: '#/components/headers/contentTypeJson'
318-
500:
308+
'500':
319309
$ref: "#/components/responses/InternalServerError"
320310
headers:
321311
Content-Type:
322312
$ref: '#/components/headers/contentTypeJson'
323-
security: [ ]
313+
security: []
324314
/auth/email/verify:
325315
post:
326316
tags:
@@ -330,23 +320,8 @@ paths:
330320
Send a verification email to the user email address.
331321
The email is only sent if have configured [SMTP mail server](https://docs.logchimp.codecarrot.net/docs/environment-variables#mail) are configured at the time of deploying LogChimp.
332322
operationId: sendVerificationEmail
333-
parameters:
334-
- $ref: '#/components/parameters/contentTypeJson'
335-
- $ref: '#/components/parameters/origin'
336-
requestBody:
337-
description: ''
338-
content:
339-
application/json:
340-
schema:
341-
type: object
342-
properties:
343-
email:
344-
type: string
345-
format: email
346-
example: "[email protected]"
347-
required: true
348323
responses:
349-
200:
324+
'200':
350325
description: ''
351326
content:
352327
application/json:
@@ -362,7 +337,7 @@ paths:
362337
headers:
363338
Content-Type:
364339
$ref: '#/components/headers/contentTypeJson'
365-
400:
340+
'400':
366341
description: Bad Request
367342
content:
368343
application/json:
@@ -376,40 +351,29 @@ paths:
376351
headers:
377352
Content-Type:
378353
$ref: '#/components/headers/contentTypeJson'
379-
500:
354+
'500':
380355
$ref: "#/components/responses/InternalServerError"
381356
headers:
382357
Content-Type:
383358
$ref: '#/components/headers/contentTypeJson'
384-
security: [ ]
385359
components:
360+
securitySchemes:
361+
bearerAuth:
362+
type: http
363+
scheme: bearer
364+
description: JWT Bearer token authentication
386365
headers:
387366
contentTypeJson:
388367
description: ''
389368
schema:
390369
type: string
391370
example: application/json
392-
parameters:
393-
contentTypeJson:
394-
name: Content-Type
395-
in: header
396-
schema:
397-
type: string
398-
default: application/json
399-
description: ''
400-
origin:
401-
name: origin
402-
in: header
403-
schema:
404-
type: string
405-
default: 'https://example.com'
406-
description: ''
407371
schemas:
408372
UserBlockedErrorCode:
409373
type: object
410374
required:
411-
- message
412-
- code
375+
- message
376+
- code
413377
properties:
414378
message:
415379
type: string
@@ -420,8 +384,8 @@ components:
420384
InvalidUserIdErrorCode:
421385
type: object
422386
required:
423-
- message
424-
- code
387+
- message
388+
- code
425389
properties:
426390
message:
427391
type: string
@@ -432,8 +396,8 @@ components:
432396
UserNotFoundErrorCode:
433397
type: object
434398
required:
435-
- message
436-
- code
399+
- message
400+
- code
437401
properties:
438402
message:
439403
type: string
@@ -444,8 +408,8 @@ components:
444408
EmailInvalidErrorCode:
445409
type: object
446410
required:
447-
- message
448-
- code
411+
- message
412+
- code
449413
properties:
450414
message:
451415
type: string
@@ -456,8 +420,8 @@ components:
456420
EmailVerifiedErrorCode:
457421
type: object
458422
required:
459-
- message
460-
- code
423+
- message
424+
- code
461425
properties:
462426
message:
463427
type: string
@@ -468,8 +432,8 @@ components:
468432
MailConfigurationErrorCode:
469433
type: object
470434
required:
471-
- message
472-
- code
435+
- message
436+
- code
473437
properties:
474438
message:
475439
type: string
@@ -483,7 +447,7 @@ components:
483447
boardId:
484448
type: string
485449
format: uuid
486-
example:
450+
example: 11c14790-b4d3-4689-942c-55548cfdd8a6
487451
name:
488452
type: string
489453
example: "🔗 Integrations"
@@ -499,7 +463,7 @@ components:
499463
format: date-time
500464
BoardDetail:
501465
allOf:
502-
- $ref: "#/components/schemas/Board"
466+
- $ref: "#/components/schemas/Board"
503467
- type: object
504468
properties:
505469
post_count:

next.config.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ const config = {
99
// Reduce bundle size by optimizing package imports for lucide-react
1010
optimizePackageImports: ["lucide-react"],
1111
},
12+
allowedDevOrigins: ["localhost"],
1213
async redirects() {
1314
return [
1415
{
@@ -19,10 +20,10 @@ const config = {
1920
];
2021
},
2122

22-
images: {
23-
// Use Cloudflare Image Resizing instead of bundling image optimization
24-
unoptimized: true,
25-
},
23+
images: {
24+
// Use Cloudflare Image Resizing instead of bundling image optimization
25+
unoptimized: true,
26+
},
2627
};
2728

2829
export default withMDX(config);

0 commit comments

Comments
 (0)