Skip to content
This repository was archived by the owner on Mar 8, 2025. It is now read-only.

Commit e34698b

Browse files
author
dnphu
committed
[Core] Update interface about Security doc
1 parent 7e1825d commit e34698b

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

src/api/core/interfaces/document.interface.ts

+48-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ export interface SwaggerDoc {
55
servers?: ServerDoc[];
66
tags?: TagDoc[];
77
paths?: any;
8-
components?: any;
8+
components?: ComponentDoc;
99
}
1010

1111
export interface TagDoc {
@@ -51,3 +51,50 @@ export interface ExternalDoc {
5151
description?: string;
5252
url?: string;
5353
}
54+
55+
export interface ComponentDoc {
56+
schemas: any;
57+
securitySchemes: {
58+
[authKey: string]: SecurityDoc | BearerAuthDoc | ApiKeyDoc;
59+
};
60+
}
61+
62+
/**
63+
* Attach link: https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md#securityRequirementObject
64+
*/
65+
export interface SecurityDoc {
66+
type?: string;
67+
description?: string;
68+
name?: string;
69+
in?: string;
70+
flows?: OAuthFlows;
71+
openIdConnectUrl?: any;
72+
scheme?: string;
73+
bearerFormat?: string;
74+
}
75+
76+
export interface OAuthFlows {
77+
implicit: OAuthFlow;
78+
password: OAuthFlow;
79+
clientCredentials: OAuthFlow;
80+
authorizationCode: OAuthFlow;
81+
}
82+
83+
export interface OAuthFlow {
84+
authorizationUrl: string;
85+
tokenUrl: string;
86+
refreshUrl: string;
87+
scopes: Record<string, string>;
88+
}
89+
90+
export type BearerAuthDoc = {
91+
type: 'http';
92+
scheme: 'bearer';
93+
bearerFormat: 'JWT';
94+
};
95+
96+
export type ApiKeyDoc = {
97+
type: 'apiKey';
98+
name: 'api_key';
99+
in: 'header';
100+
};

0 commit comments

Comments
 (0)