@necessarylion/adonis-autoswagger 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -4
- package/dist/autoswagger.js +32 -27
- package/dist/example.js +3 -0
- package/dist/parsers.d.ts +5 -2
- package/dist/parsers.js +24 -9
- package/dist/scalarCustomCss.d.ts +1 -1
- package/dist/scalarCustomCss.js +14 -1
- package/dist/types.js +1 -0
- package/package.json +9 -8
package/README.md
CHANGED
|
@@ -13,11 +13,13 @@ Adonis AutoSwagger <br />
|
|
|
13
13
|
## 💻️ Install
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pnpm i adonis-autoswagger #using pnpm
|
|
16
|
+
pnpm i @necessarylion/adonis-autoswagger #using pnpm
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
|
+
*This is a fork of [adonis-autoswagger](https://github.com/ad-on-is/adonis-autoswagger) with some additional features.*
|
|
22
|
+
|
|
21
23
|
## ⭐️ Features
|
|
22
24
|
|
|
23
25
|
- Creates **paths** automatically based on `routes.ts`
|
|
@@ -76,7 +78,7 @@ In your `routes.ts`
|
|
|
76
78
|
## 6️⃣ for AdonisJS v6
|
|
77
79
|
|
|
78
80
|
```js
|
|
79
|
-
import AutoSwagger from "adonis-autoswagger";
|
|
81
|
+
import AutoSwagger from "@necessarylion/adonis-autoswagger";
|
|
80
82
|
import swagger from "#config/swagger";
|
|
81
83
|
// returns swagger in YAML
|
|
82
84
|
router.get("/swagger", async () => {
|
|
@@ -94,7 +96,7 @@ router.get("/docs", async () => {
|
|
|
94
96
|
## 5️⃣ for AdonisJS v5
|
|
95
97
|
|
|
96
98
|
```js
|
|
97
|
-
import AutoSwagger from "adonis-autoswagger";
|
|
99
|
+
import AutoSwagger from "@necessarylion/adonis-autoswagger";
|
|
98
100
|
import swagger from "Config/swagger";
|
|
99
101
|
// returns swagger in YAML
|
|
100
102
|
Route.get("/swagger", async () => {
|
|
@@ -456,6 +458,71 @@ Generates responses and requestBody based on your simple Controller-Annotation (
|
|
|
456
458
|
|
|
457
459
|
## Schemas
|
|
458
460
|
|
|
461
|
+
### Validators
|
|
462
|
+
|
|
463
|
+
Automatically generates swagger schema-descriptions based on your validators.
|
|
464
|
+
|
|
465
|
+
#### Adding example values
|
|
466
|
+
|
|
467
|
+
```ts
|
|
468
|
+
export const adminLogin = vine.compile(
|
|
469
|
+
vine.object({
|
|
470
|
+
email: vine.string().trim().example('admin@laconcept.de'),
|
|
471
|
+
password: vine.string().trim().example('password'),
|
|
472
|
+
})
|
|
473
|
+
)
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
##### Create custom validators with vine
|
|
477
|
+
|
|
478
|
+
```ts
|
|
479
|
+
// start/validators/example.ts
|
|
480
|
+
|
|
481
|
+
import vine, { VineNumber, VineString, VineNativeEnum } from '@vinejs/vine'
|
|
482
|
+
import { EnumLike } from '@vinejs/vine/types'
|
|
483
|
+
|
|
484
|
+
type Options = {
|
|
485
|
+
example: any
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
declare module '@vinejs/vine' {
|
|
489
|
+
interface VineString {
|
|
490
|
+
example(example: string): this
|
|
491
|
+
}
|
|
492
|
+
interface VineNumber {
|
|
493
|
+
example(example: number): this
|
|
494
|
+
}
|
|
495
|
+
interface VineNativeEnum<Values extends EnumLike> {
|
|
496
|
+
example(example: string): this
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
export const exampleRule = vine.createRule((_: unknown, opt: Options) => {
|
|
501
|
+
return opt.example
|
|
502
|
+
})
|
|
503
|
+
|
|
504
|
+
VineString.macro('example', function (this: VineString, example: string) {
|
|
505
|
+
return this.use(exampleRule({ example }))
|
|
506
|
+
})
|
|
507
|
+
VineNumber.macro('example', function (this: VineNumber, example: number) {
|
|
508
|
+
return this.use(exampleRule({ example }))
|
|
509
|
+
})
|
|
510
|
+
VineNativeEnum.macro('example', function (this: VineNativeEnum<any>, example: string) {
|
|
511
|
+
return this.use(exampleRule({ example }))
|
|
512
|
+
})
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
##### Import in `adonisrc.ts` preloads
|
|
516
|
+
|
|
517
|
+
```ts
|
|
518
|
+
preloads: [
|
|
519
|
+
() => import('#start/routes'),
|
|
520
|
+
() => import('#start/kernel'),
|
|
521
|
+
() => import('#start/sentry'),
|
|
522
|
+
() => import('#start/validators/example.ts'),
|
|
523
|
+
],
|
|
524
|
+
```
|
|
525
|
+
|
|
459
526
|
### Models
|
|
460
527
|
|
|
461
528
|
Automatically generates swagger schema-descriptions based on your models
|
|
@@ -464,7 +531,16 @@ Automatically generates swagger schema-descriptions based on your models
|
|
|
464
531
|
|
|
465
532
|
### Interfaces
|
|
466
533
|
|
|
467
|
-
Instead of using `param: any` you can now use custom interfaces `param: UserDetails`. The interfaces files need to be located at `app/Interfaces/`
|
|
534
|
+
Instead of using `param: any` you can now use custom interfaces `param: UserDetails`. The interfaces files need to be located at `app/Interfaces/` or `app/interfaces/`
|
|
535
|
+
|
|
536
|
+
```ts
|
|
537
|
+
export interface UserDetails {
|
|
538
|
+
// @example(John Doe)
|
|
539
|
+
name: string;
|
|
540
|
+
// @example(johndoe@example.com)
|
|
541
|
+
email: string;
|
|
542
|
+
}
|
|
543
|
+
```
|
|
468
544
|
|
|
469
545
|
### Enums
|
|
470
546
|
|
package/dist/autoswagger.js
CHANGED
|
@@ -41,9 +41,10 @@ const json_to_pretty_yaml_1 = __importDefault(require("json-to-pretty-yaml"));
|
|
|
41
41
|
const fs_1 = __importDefault(require("fs"));
|
|
42
42
|
const path_1 = __importDefault(require("path"));
|
|
43
43
|
const util_1 = __importDefault(require("util"));
|
|
44
|
+
const lodash_1 = require("lodash");
|
|
44
45
|
const http_status_code_1 = __importDefault(require("http-status-code"));
|
|
45
|
-
const
|
|
46
|
-
const
|
|
46
|
+
const lodash_2 = __importDefault(require("lodash"));
|
|
47
|
+
const lodash_3 = require("lodash");
|
|
47
48
|
const fs_2 = require("fs");
|
|
48
49
|
const scalarCustomCss_1 = require("./scalarCustomCss");
|
|
49
50
|
const adonishelpers_1 = require("./adonishelpers");
|
|
@@ -279,22 +280,23 @@ class AutoSwagger {
|
|
|
279
280
|
description: "The resource has been created",
|
|
280
281
|
},
|
|
281
282
|
},
|
|
282
|
-
securitySchemes:
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
283
|
+
securitySchemes: this.options.securitySchemes
|
|
284
|
+
? this.options.securitySchemes
|
|
285
|
+
: {
|
|
286
|
+
BearerAuth: {
|
|
287
|
+
type: "http",
|
|
288
|
+
scheme: "bearer",
|
|
289
|
+
},
|
|
290
|
+
BasicAuth: {
|
|
291
|
+
type: "http",
|
|
292
|
+
scheme: "basic",
|
|
293
|
+
},
|
|
294
|
+
ApiKeyAuth: {
|
|
295
|
+
type: "apiKey",
|
|
296
|
+
in: "header",
|
|
297
|
+
name: "X-API-Key",
|
|
298
|
+
},
|
|
295
299
|
},
|
|
296
|
-
...this.options.securitySchemes,
|
|
297
|
-
},
|
|
298
300
|
schemas: this.schemas,
|
|
299
301
|
},
|
|
300
302
|
paths: {},
|
|
@@ -355,10 +357,9 @@ class AutoSwagger {
|
|
|
355
357
|
return;
|
|
356
358
|
globalTags.push({
|
|
357
359
|
name: tag,
|
|
358
|
-
description: "Everything related to " + tag,
|
|
359
360
|
});
|
|
360
361
|
});
|
|
361
|
-
|
|
362
|
+
let { sourceFile, action, customAnnotations, operationId } = await this.getDataBasedOnAdonisVersion(route);
|
|
362
363
|
route.methods.forEach((method) => {
|
|
363
364
|
let responses = {};
|
|
364
365
|
if (method === "HEAD")
|
|
@@ -397,12 +398,11 @@ class AutoSwagger {
|
|
|
397
398
|
parameters = (0, helpers_1.mergeParams)(parameters, actionParams);
|
|
398
399
|
if (tag != "") {
|
|
399
400
|
globalTags.push({
|
|
400
|
-
name: tag.toUpperCase()
|
|
401
|
-
description: "Everything related to " + tag.toUpperCase(),
|
|
401
|
+
name: tag.toUpperCase()
|
|
402
402
|
});
|
|
403
403
|
tags = [tag.toUpperCase()];
|
|
404
404
|
}
|
|
405
|
-
if ((0,
|
|
405
|
+
if ((0, lodash_3.isEmpty)(responses)) {
|
|
406
406
|
responses[responseCodes[method]] = {
|
|
407
407
|
description: http_status_code_1.default.getMessage(responseCodes[method]),
|
|
408
408
|
content: {
|
|
@@ -453,9 +453,10 @@ class AutoSwagger {
|
|
|
453
453
|
break;
|
|
454
454
|
}
|
|
455
455
|
}
|
|
456
|
+
action = (0, lodash_1.startCase)(action);
|
|
456
457
|
const sf = sourceFile.split("/").at(-1).replace(".ts", "");
|
|
457
458
|
let m = {
|
|
458
|
-
summary: `${summary}${action !== "" ? `
|
|
459
|
+
summary: `${summary}${action !== "" ? ` ${action}` : "route"}`,
|
|
459
460
|
description: description + "\n\n _" + sourceFile + "_ - **" + action + "**",
|
|
460
461
|
operationId: operationId,
|
|
461
462
|
parameters: parameters,
|
|
@@ -477,7 +478,7 @@ class AutoSwagger {
|
|
|
477
478
|
});
|
|
478
479
|
}
|
|
479
480
|
// filter unused tags
|
|
480
|
-
const usedTags =
|
|
481
|
+
const usedTags = lodash_2.default.uniq(Object.entries(paths)
|
|
481
482
|
.map(([p, val]) => Object.entries(val)[0][1].tags)
|
|
482
483
|
.flat());
|
|
483
484
|
docs.tags = globalTags.filter((tag) => usedTags.includes(tag.name));
|
|
@@ -496,7 +497,7 @@ class AutoSwagger {
|
|
|
496
497
|
sourceFile = route.meta.resolvedHandler.namespace;
|
|
497
498
|
action = route.meta.resolvedHandler.method;
|
|
498
499
|
// If not defined by an annotation, use the combination of "controllerNameMethodName"
|
|
499
|
-
if (action !== "" && (0,
|
|
500
|
+
if (action !== "" && (0, lodash_3.isUndefined)(operationId) && route.handler) {
|
|
500
501
|
operationId = (0, helpers_1.formatOperationId)(route.handler);
|
|
501
502
|
}
|
|
502
503
|
}
|
|
@@ -547,7 +548,7 @@ class AutoSwagger {
|
|
|
547
548
|
if (this.options.debug) {
|
|
548
549
|
if (sourceFile !== "") {
|
|
549
550
|
console.log(typeof customAnnotations !== "undefined" &&
|
|
550
|
-
!
|
|
551
|
+
!lodash_2.default.isEmpty(customAnnotations)
|
|
551
552
|
? `\x1b[32m✓ FOUND for ${action}\x1b[0m`
|
|
552
553
|
: `\x1b[33m✗ MISSING for ${action}\x1b[0m`, `${sourceFile} (${route.methods[0].toUpperCase()} ${route.pattern})`);
|
|
553
554
|
}
|
|
@@ -675,10 +676,14 @@ class AutoSwagger {
|
|
|
675
676
|
}
|
|
676
677
|
let schema = {
|
|
677
678
|
type: "object",
|
|
678
|
-
required: parsed.required,
|
|
679
679
|
properties: parsed.props,
|
|
680
680
|
description: name + " (Model)",
|
|
681
681
|
};
|
|
682
|
+
if (parsed.required.length > 0) {
|
|
683
|
+
schema['required'] = parsed.required;
|
|
684
|
+
}
|
|
685
|
+
if (name.toLowerCase().includes('readme.md'))
|
|
686
|
+
continue;
|
|
682
687
|
models[name] = schema;
|
|
683
688
|
}
|
|
684
689
|
return models;
|
package/dist/example.js
CHANGED
|
@@ -262,6 +262,8 @@ class ExampleGenerator {
|
|
|
262
262
|
return this.exampleByField("date");
|
|
263
263
|
case "object":
|
|
264
264
|
return {};
|
|
265
|
+
case "uuid":
|
|
266
|
+
return this.exampleByField("uuid");
|
|
265
267
|
default:
|
|
266
268
|
return null;
|
|
267
269
|
}
|
|
@@ -292,6 +294,7 @@ class ExampleGenerator {
|
|
|
292
294
|
price: 10.5,
|
|
293
295
|
avatar: "https://example.com/avatar.png",
|
|
294
296
|
url: "https://example.com",
|
|
297
|
+
uuid: "2b0bf725-d404-481f-b431-17f1182a5e57"
|
|
295
298
|
};
|
|
296
299
|
if (typeof ex[field] !== "undefined") {
|
|
297
300
|
return ex[field];
|
package/dist/parsers.d.ts
CHANGED
|
@@ -52,11 +52,14 @@ export declare class ValidatorParser {
|
|
|
52
52
|
validatorToObject(validator: VineValidator<any, any>): Promise<any>;
|
|
53
53
|
parsePropsAndMeta(obj: any, testObj: any, validator: VineValidator<any, any>): Promise<any>;
|
|
54
54
|
objToTest(obj: any): {};
|
|
55
|
-
parseSchema(json: any, refs: any): {
|
|
55
|
+
parseSchema(json: any, refs: any): {
|
|
56
|
+
properties: {};
|
|
57
|
+
};
|
|
58
|
+
getType(type: string): string;
|
|
56
59
|
getMetaFromValidations(validations: any, refs: any): {
|
|
57
60
|
minimum?: number;
|
|
58
61
|
maximum?: number;
|
|
59
|
-
|
|
62
|
+
enum?: any;
|
|
60
63
|
pattern?: string;
|
|
61
64
|
example?: any;
|
|
62
65
|
};
|
package/dist/parsers.js
CHANGED
|
@@ -110,7 +110,7 @@ class CommentParser {
|
|
|
110
110
|
return h;
|
|
111
111
|
}
|
|
112
112
|
if (line.startsWith("@paramPath")) {
|
|
113
|
-
required =
|
|
113
|
+
required = true;
|
|
114
114
|
}
|
|
115
115
|
if (line.startsWith("@paramQuery")) {
|
|
116
116
|
required = false;
|
|
@@ -621,6 +621,11 @@ class ModelParser {
|
|
|
621
621
|
type = "string";
|
|
622
622
|
format = "date";
|
|
623
623
|
}
|
|
624
|
+
if (type === "uuid") {
|
|
625
|
+
indicator = "type";
|
|
626
|
+
type = "string";
|
|
627
|
+
format = "uuid";
|
|
628
|
+
}
|
|
624
629
|
if (field === "email") {
|
|
625
630
|
indicator = "type";
|
|
626
631
|
type = "string";
|
|
@@ -688,7 +693,7 @@ class ValidatorParser {
|
|
|
688
693
|
// console.dir(json, { depth: null });
|
|
689
694
|
const obj = {
|
|
690
695
|
type: "object",
|
|
691
|
-
|
|
696
|
+
...this.parseSchema(validator.toJSON()["schema"]["schema"], validator.toJSON()["refs"]),
|
|
692
697
|
};
|
|
693
698
|
// console.dir(obj, { depth: null });
|
|
694
699
|
const testObj = this.objToTest(obj["properties"]);
|
|
@@ -779,6 +784,7 @@ class ValidatorParser {
|
|
|
779
784
|
}
|
|
780
785
|
parseSchema(json, refs) {
|
|
781
786
|
const obj = {};
|
|
787
|
+
const required = [];
|
|
782
788
|
for (const p of json["properties"]) {
|
|
783
789
|
let meta = this.getMetaFromValidations(p["validations"], refs);
|
|
784
790
|
// console.dir(p, { depth: null });
|
|
@@ -788,7 +794,7 @@ class ValidatorParser {
|
|
|
788
794
|
const field = p["fieldName"];
|
|
789
795
|
if (type === "object") {
|
|
790
796
|
console.log(field, p);
|
|
791
|
-
obj[field] = { type: "object",
|
|
797
|
+
obj[field] = { type: "object", ...this.parseSchema(p, refs) };
|
|
792
798
|
}
|
|
793
799
|
else {
|
|
794
800
|
// if array
|
|
@@ -798,7 +804,7 @@ class ValidatorParser {
|
|
|
798
804
|
type: "array",
|
|
799
805
|
items: {
|
|
800
806
|
type: "object",
|
|
801
|
-
|
|
807
|
+
...this.parseSchema(p["each"], refs),
|
|
802
808
|
}
|
|
803
809
|
};
|
|
804
810
|
}
|
|
@@ -807,7 +813,7 @@ class ValidatorParser {
|
|
|
807
813
|
obj[field] = {
|
|
808
814
|
type: "array",
|
|
809
815
|
items: {
|
|
810
|
-
type: "
|
|
816
|
+
type: this.getType(p["each"]["type"]),
|
|
811
817
|
...meta,
|
|
812
818
|
example: meta.example ?? meta.minimum ?? this.exampleGenerator.exampleByType("number"),
|
|
813
819
|
},
|
|
@@ -816,16 +822,25 @@ class ValidatorParser {
|
|
|
816
822
|
}
|
|
817
823
|
else {
|
|
818
824
|
obj[field] = {
|
|
819
|
-
type:
|
|
825
|
+
type: this.getType(type),
|
|
820
826
|
example: meta.example ?? meta.minimum ?? this.exampleGenerator.exampleByType("number"),
|
|
821
827
|
...meta,
|
|
822
828
|
};
|
|
823
829
|
}
|
|
824
830
|
}
|
|
825
831
|
if (!p["isOptional"])
|
|
826
|
-
|
|
832
|
+
required.push(p["fieldName"]);
|
|
827
833
|
}
|
|
828
|
-
|
|
834
|
+
const res = { properties: obj };
|
|
835
|
+
if (required.length > 0)
|
|
836
|
+
res["required"] = required;
|
|
837
|
+
return res;
|
|
838
|
+
}
|
|
839
|
+
getType(type) {
|
|
840
|
+
if (type == 'literal') {
|
|
841
|
+
return 'string';
|
|
842
|
+
}
|
|
843
|
+
return type;
|
|
829
844
|
}
|
|
830
845
|
getMetaFromValidations(validations, refs) {
|
|
831
846
|
let meta = {};
|
|
@@ -840,7 +855,7 @@ class ValidatorParser {
|
|
|
840
855
|
meta = { ...meta, maximum: refs[v["ruleFnId"]].options.max };
|
|
841
856
|
}
|
|
842
857
|
if (refs[v["ruleFnId"]].options?.choices) {
|
|
843
|
-
meta = { ...meta,
|
|
858
|
+
meta = { ...meta, enum: refs[v["ruleFnId"]].options.choices };
|
|
844
859
|
}
|
|
845
860
|
if (refs[v["ruleFnId"]].options?.toString().includes("/")) {
|
|
846
861
|
meta = { ...meta, pattern: refs[v["ruleFnId"]].options.toString() };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const scalarCustomCss = "\n/* basic theme */\n.light-mode {\n --theme-background-1: #fff;\n --theme-background-2: #fafaf9;\n --theme-background-3: rgb(245 245 245);\n\n --theme-color-1: #21201c;\n --theme-color-2: #63635d;\n --theme-color-3: #8e8e8e;\n\n --theme-color-accent: #5a45ff;\n --theme-background-accent: #5a45ff1f;\n\n --theme-border-color: color(display-p3 0.913 0.912 0.903);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n.dark-mode {\n --theme-background-1: #0f0f0f;\n --theme-background-2: #222222;\n --theme-background-3: #272727;\n\n --theme-color-1: #e2e4e8;\n --theme-color-2: rgba(255, 255, 255, 0.62);\n --theme-color-3: #6a737d;\n\n --theme-color-accent: #e2ddfe;\n --theme-background-accent: #3c2d6a;\n\n --theme-border-color: rgba(255, 255, 255, 0.1);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n\n/* Document Sidebar */\n.light-mode .t-doc__sidebar,\n.dark-mode .t-doc__sidebar {\n --sidebar-background-1: var(--theme-background-1);\n --sidebar-color-1: var(--theme-color-1);\n --sidebar-color-2: var(--theme-color-2);\n --sidebar-border-color: var(--theme-border-color);\n\n --sidebar-item-hover-background: var(--theme-background-2);\n --sidebar-item-hover-color: currentColor;\n\n --sidebar-item-active-background: var(--theme-background-accent);\n --sidebar-color-active: var(--theme-color-accent);\n\n --sidebar-search-background: var(--theme-background-2);\n --sidebar-search-color: var(--theme-color-3);\n --sidebar-search-border-color: var(--theme-border-color);\n}\n\n/* advanced */\n.light-mode {\n --theme-color-green: #0e766e;\n --theme-color-red: #e53935;\n --theme-color-yellow: #e2931d;\n --theme-color-blue: #0f766e;\n --theme-color-orange: #f76d47;\n --theme-color-purple: #4338ca;\n}\n.dark-mode {\n --theme-color-green: #0ad8b6;\n --theme-color-red: #e5484d;\n --theme-color-yellow: #eac063;\n --theme-color-blue: #6abaff;\n --theme-color-orange: #ff9b52;\n --theme-color-purple: #6550b9;\n}\n/* custom-theme */\n.show-api-client-button:before {\n background: white !important;\n}\n.show-api-client-button span,\n.show-api-client-button svg {\n color: var(--theme-background-1) !important;\n}\n.section:not(:last-of-type),\n.section-container {\n border-top: none !important;\n border-bottom: none !important;\n}\n.section-container:after,\n.tag-section-container section.section:after {\n content: \"\";\n width: 100%;\n height: 1px;\n position: absolute;\n top: 0;\n left: 0;\n background: repeating-linear-gradient(\n 90deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n}\n.section-container:nth-of-type(2):after {\n display: none;\n}\n.tag-section-container .section:first-of-type:after {\n display: none;\n}\n.sidebar {\n border-right: none !important;\n}\n.t-doc__sidebar {\n position: relative;\n}\n.t-doc__sidebar:after {\n content: \"\";\n width: 1px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n background: repeating-linear-gradient(\n 0deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n display: block;\n}\n.download-cta .download-button,\n.scalar-api-reference .section .markdown a {\n --theme-color-accent: var(--theme-color-1) !important;\n text-decoration: underline !important;\n cursor: pointer;\n}";
|
|
1
|
+
export declare const scalarCustomCss = "\n/* basic theme */\n.light-mode {\n --theme-background-1: #fff;\n --theme-background-2: #fafaf9;\n --theme-background-3: rgb(245 245 245);\n\n --theme-color-1: #21201c;\n --theme-color-2: #63635d;\n --theme-color-3: #8e8e8e;\n\n --theme-color-accent: #5a45ff;\n --theme-background-accent: #5a45ff1f;\n\n --theme-border-color: color(display-p3 0.913 0.912 0.903);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n.dark-mode {\n --theme-background-1: #0f0f0f;\n --theme-background-2: #222222;\n --theme-background-3: #272727;\n\n --theme-color-1: #e2e4e8;\n --theme-color-2: rgba(255, 255, 255, 0.62);\n --theme-color-3: #6a737d;\n\n --theme-color-accent: #e2ddfe;\n --theme-background-accent: #3c2d6a;\n\n --theme-border-color: rgba(255, 255, 255, 0.1);\n --theme-code-language-color-supersede: var(--theme-color-1);\n --theme-code-languages-background-supersede: var(--theme-background-3);\n}\n\n/* Document Sidebar */\n.light-mode .t-doc__sidebar,\n.dark-mode .t-doc__sidebar {\n --sidebar-background-1: var(--theme-background-1);\n --sidebar-color-1: var(--theme-color-1);\n --sidebar-color-2: var(--theme-color-2);\n --sidebar-border-color: var(--theme-border-color);\n\n --sidebar-item-hover-background: var(--theme-background-2);\n --sidebar-item-hover-color: currentColor;\n\n --sidebar-item-active-background: var(--theme-background-accent);\n --sidebar-color-active: var(--theme-color-accent);\n\n --sidebar-search-background: var(--theme-background-2);\n --sidebar-search-color: var(--theme-color-3);\n --sidebar-search-border-color: var(--theme-border-color);\n}\n\n/* advanced */\n.light-mode {\n --theme-color-green: #0e766e;\n --theme-color-red: #e53935;\n --theme-color-yellow: #e2931d;\n --theme-color-blue: #0f766e;\n --theme-color-orange: #f76d47;\n --theme-color-purple: #4338ca;\n}\n.dark-mode {\n --theme-color-green: #0ad8b6;\n --theme-color-red: #e5484d;\n --theme-color-yellow: #eac063;\n --theme-color-blue: #6abaff;\n --theme-color-orange: #ff9b52;\n --theme-color-purple: #6550b9;\n}\n/* custom-theme */\n.show-api-client-button:before {\n background: white !important;\n}\n.show-api-client-button span,\n.show-api-client-button svg {\n color: var(--theme-background-1) !important;\n}\n.section:not(:last-of-type),\n.section-container {\n border-top: none !important;\n border-bottom: none !important;\n}\n.section-container:after,\n.tag-section-container section.section:after {\n content: \"\";\n width: 100%;\n height: 1px;\n position: absolute;\n top: 0;\n left: 0;\n background: repeating-linear-gradient(\n 90deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n}\n.section-container:nth-of-type(2):after {\n display: none;\n}\n.tag-section-container .section:first-of-type:after {\n display: none;\n}\n.sidebar {\n border-right: none !important;\n}\n.t-doc__sidebar {\n position: relative;\n}\n.t-doc__sidebar:after {\n content: \"\";\n width: 1px;\n height: 100%;\n position: absolute;\n right: 0;\n top: 0;\n background: repeating-linear-gradient(\n 0deg,\n var(--theme-border-color) 0 4px,\n transparent 0 8px\n );\n display: block;\n}\n.download-cta .download-button,\n.scalar-api-reference .section .markdown a {\n --theme-color-accent: var(--theme-color-1) !important;\n text-decoration: underline !important;\n cursor: pointer;\n}\n.sidebar-heading-link[tabindex=\"-1\"] .sidebar-heading-link-title {\n font-weight: bold !important;\n font-family: monospace;\n text-transform: uppercase;\n}\n.scalar .scalar-app-layout {\n max-width: 95% !important;\n box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px !important;\n}\n.scalar-container {\n background: #434343d4 !important; \n}\n";
|
package/dist/scalarCustomCss.js
CHANGED
|
@@ -130,4 +130,17 @@ exports.scalarCustomCss = `
|
|
|
130
130
|
--theme-color-accent: var(--theme-color-1) !important;
|
|
131
131
|
text-decoration: underline !important;
|
|
132
132
|
cursor: pointer;
|
|
133
|
-
}
|
|
133
|
+
}
|
|
134
|
+
.sidebar-heading-link[tabindex="-1"] .sidebar-heading-link-title {
|
|
135
|
+
font-weight: bold !important;
|
|
136
|
+
font-family: monospace;
|
|
137
|
+
text-transform: uppercase;
|
|
138
|
+
}
|
|
139
|
+
.scalar .scalar-app-layout {
|
|
140
|
+
max-width: 95% !important;
|
|
141
|
+
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px !important;
|
|
142
|
+
}
|
|
143
|
+
.scalar-container {
|
|
144
|
+
background: #434343d4 !important;
|
|
145
|
+
}
|
|
146
|
+
`;
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@necessarylion/adonis-autoswagger",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Auto-Generate swagger docs for AdonisJS",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
9
|
+
"dev": "watchexec -e ts -- tsc",
|
|
10
|
+
"build": "tsc",
|
|
11
|
+
"prepare": "npm run build"
|
|
12
|
+
},
|
|
7
13
|
"author": "Adis Durakovic <adis.durakovic@gmail.com>",
|
|
8
14
|
"repository": {
|
|
9
15
|
"type": "git",
|
|
@@ -38,10 +44,5 @@
|
|
|
38
44
|
"bracketSpacing": true,
|
|
39
45
|
"arrowParens": "always"
|
|
40
46
|
},
|
|
41
|
-
"packageManager": "pnpm@8.11.0"
|
|
42
|
-
|
|
43
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
44
|
-
"dev": "watchexec -e ts -- tsc",
|
|
45
|
-
"build": "tsc"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
47
|
+
"packageManager": "pnpm@8.11.0"
|
|
48
|
+
}
|