Skip to content

Commit 899b4ee

Browse files
authored
fix: swagger annotations (#1198)
* fix: swagger annotations fixes #1197 * ci: fix e2e by migrating to mxschmitt/playwright-go v0.6100.0 The playwright-community/playwright-go v0.5200.0 driver downloads from playwright.azureedge.net, which Microsoft has decommissioned, so the driver download now 404s and the e2e tests fail with 'please install the driver (v1.52.0) first'. Upstream fixed this by assembling the driver from the npm registry (playwright-core) plus Node.js from nodejs.org instead of the dead CDN. That fix ships in v0.6100.0, which also renamed the module path to github.com/mxschmitt/playwright-go. Bump to it and update the imports; the API is unchanged.
1 parent 585ea34 commit 899b4ee

14 files changed

Lines changed: 454 additions & 200 deletions

File tree

docs/swagger/docs.go

Lines changed: 108 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@ const docTemplate = `{
159159
},
160160
"/api/v1/auth/account": {
161161
"patch": {
162+
"security": [
163+
{
164+
"ApiKeyAuth": []
165+
}
166+
],
162167
"produces": [
163168
"application/json"
164169
],
@@ -226,6 +231,11 @@ const docTemplate = `{
226231
},
227232
"/api/v1/auth/logout": {
228233
"post": {
234+
"security": [
235+
{
236+
"ApiKeyAuth": []
237+
}
238+
],
229239
"produces": [
230240
"application/json"
231241
],
@@ -245,6 +255,11 @@ const docTemplate = `{
245255
},
246256
"/api/v1/auth/me": {
247257
"get": {
258+
"security": [
259+
{
260+
"ApiKeyAuth": []
261+
}
262+
],
248263
"produces": [
249264
"application/json"
250265
],
@@ -267,6 +282,11 @@ const docTemplate = `{
267282
},
268283
"/api/v1/auth/refresh": {
269284
"post": {
285+
"security": [
286+
{
287+
"ApiKeyAuth": []
288+
}
289+
],
270290
"produces": [
271291
"application/json"
272292
],
@@ -289,11 +309,16 @@ const docTemplate = `{
289309
},
290310
"/api/v1/bookmarks/bulk/tags": {
291311
"put": {
312+
"security": [
313+
{
314+
"ApiKeyAuth": []
315+
}
316+
],
292317
"produces": [
293318
"application/json"
294319
],
295320
"tags": [
296-
"Auth"
321+
"Bookmarks"
297322
],
298323
"summary": "Bulk update tags for multiple bookmarks.",
299324
"parameters": [
@@ -331,11 +356,16 @@ const docTemplate = `{
331356
},
332357
"/api/v1/bookmarks/cache": {
333358
"put": {
359+
"security": [
360+
{
361+
"ApiKeyAuth": []
362+
}
363+
],
334364
"produces": [
335365
"application/json"
336366
],
337367
"tags": [
338-
"Auth"
368+
"Bookmarks"
339369
],
340370
"summary": "Update Cache and Ebook on server.",
341371
"parameters": [
@@ -362,15 +392,29 @@ const docTemplate = `{
362392
}
363393
}
364394
},
365-
"/api/v1/bookmarks/id/readable": {
395+
"/api/v1/bookmarks/{id}/readable": {
366396
"get": {
397+
"security": [
398+
{
399+
"ApiKeyAuth": []
400+
}
401+
],
367402
"produces": [
368403
"application/json"
369404
],
370405
"tags": [
371-
"Auth"
406+
"Bookmarks"
372407
],
373408
"summary": "Get readable version of bookmark.",
409+
"parameters": [
410+
{
411+
"type": "integer",
412+
"description": "Bookmark ID",
413+
"name": "id",
414+
"in": "path",
415+
"required": true
416+
}
417+
],
374418
"responses": {
375419
"200": {
376420
"description": "OK",
@@ -386,11 +430,16 @@ const docTemplate = `{
386430
},
387431
"/api/v1/bookmarks/{id}/tags": {
388432
"get": {
433+
"security": [
434+
{
435+
"ApiKeyAuth": []
436+
}
437+
],
389438
"produces": [
390439
"application/json"
391440
],
392441
"tags": [
393-
"Auth"
442+
"Bookmarks"
394443
],
395444
"summary": "Get tags for a bookmark.",
396445
"parameters": [
@@ -421,11 +470,16 @@ const docTemplate = `{
421470
}
422471
},
423472
"post": {
473+
"security": [
474+
{
475+
"ApiKeyAuth": []
476+
}
477+
],
424478
"produces": [
425479
"application/json"
426480
],
427481
"tags": [
428-
"Auth"
482+
"Bookmarks"
429483
],
430484
"summary": "Add a tag to a bookmark.",
431485
"parameters": [
@@ -459,11 +513,16 @@ const docTemplate = `{
459513
}
460514
},
461515
"delete": {
516+
"security": [
517+
{
518+
"ApiKeyAuth": []
519+
}
520+
],
462521
"produces": [
463522
"application/json"
464523
],
465524
"tags": [
466-
"Auth"
525+
"Bookmarks"
467526
],
468527
"summary": "Remove a tag from a bookmark.",
469528
"parameters": [
@@ -499,6 +558,11 @@ const docTemplate = `{
499558
},
500559
"/api/v1/system/info": {
501560
"get": {
561+
"security": [
562+
{
563+
"ApiKeyAuth": []
564+
}
565+
],
502566
"description": "Get general system information like Shiori version, database, and OS",
503567
"produces": [
504568
"application/json"
@@ -522,6 +586,11 @@ const docTemplate = `{
522586
},
523587
"/api/v1/tags": {
524588
"get": {
589+
"security": [
590+
{
591+
"ApiKeyAuth": []
592+
}
593+
],
525594
"description": "List all tags",
526595
"produces": [
527596
"application/json"
@@ -569,6 +638,11 @@ const docTemplate = `{
569638
}
570639
},
571640
"post": {
641+
"security": [
642+
{
643+
"ApiKeyAuth": []
644+
}
645+
],
572646
"description": "Create a new tag",
573647
"consumes": [
574648
"application/json"
@@ -612,6 +686,11 @@ const docTemplate = `{
612686
},
613687
"/api/v1/tags/{id}": {
614688
"get": {
689+
"security": [
690+
{
691+
"ApiKeyAuth": []
692+
}
693+
],
615694
"description": "Get a tag by ID",
616695
"produces": [
617696
"application/json"
@@ -648,6 +727,11 @@ const docTemplate = `{
648727
}
649728
},
650729
"put": {
730+
"security": [
731+
{
732+
"ApiKeyAuth": []
733+
}
734+
],
651735
"description": "Update an existing tag",
652736
"consumes": [
653737
"application/json"
@@ -699,6 +783,11 @@ const docTemplate = `{
699783
}
700784
},
701785
"delete": {
786+
"security": [
787+
{
788+
"ApiKeyAuth": []
789+
}
790+
],
702791
"description": "Delete a tag",
703792
"tags": [
704793
"Tags"
@@ -1020,17 +1109,25 @@ const docTemplate = `{
10201109
}
10211110
}
10221111
}
1112+
},
1113+
"securityDefinitions": {
1114+
"ApiKeyAuth": {
1115+
"description": "Type \"Bearer\" followed by a space and the JWT token.",
1116+
"type": "apiKey",
1117+
"name": "Authorization",
1118+
"in": "header"
1119+
}
10231120
}
10241121
}`
10251122

10261123
// SwaggerInfo holds exported Swagger Info so clients can modify it
10271124
var SwaggerInfo = &swag.Spec{
1028-
Version: "",
1125+
Version: "1.0",
10291126
Host: "",
1030-
BasePath: "",
1127+
BasePath: "/",
10311128
Schemes: []string{},
1032-
Title: "",
1033-
Description: "",
1129+
Title: "Shiori API",
1130+
Description: "Shiori is a simple bookmarks manager. This is the documentation for its HTTP API.",
10341131
InfoInstanceName: "swagger",
10351132
SwaggerTemplate: docTemplate,
10361133
LeftDelim: "{{",

0 commit comments

Comments
 (0)