@twin.org/ts-to-openapi 0.0.1-next.2

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.
Files changed (32) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +21 -0
  3. package/bin/index.js +8 -0
  4. package/dist/cjs/index.cjs +1124 -0
  5. package/dist/esm/index.mjs +1118 -0
  6. package/dist/locales/en.json +274 -0
  7. package/dist/types/cli.d.ts +19 -0
  8. package/dist/types/commands/httpStatusCodeMap.d.ts +20 -0
  9. package/dist/types/commands/tsToOpenApi.d.ts +21 -0
  10. package/dist/types/index.d.ts +4 -0
  11. package/dist/types/models/IInputPath.d.ts +68 -0
  12. package/dist/types/models/IInputResult.d.ts +15 -0
  13. package/dist/types/models/IOpenApi.d.ts +54 -0
  14. package/dist/types/models/IOpenApiExample.d.ts +13 -0
  15. package/dist/types/models/IOpenApiHeader.d.ts +19 -0
  16. package/dist/types/models/IOpenApiPathMethod.d.ts +64 -0
  17. package/dist/types/models/IOpenApiResponse.d.ts +32 -0
  18. package/dist/types/models/IOpenApiSecurityScheme.d.ts +25 -0
  19. package/dist/types/models/IPackageJson.d.ts +15 -0
  20. package/dist/types/models/ITsToOpenApiConfig.d.ts +61 -0
  21. package/dist/types/models/ITsToOpenApiConfigEntryPoint.d.ts +17 -0
  22. package/docs/changelog.md +5 -0
  23. package/docs/examples.md +890 -0
  24. package/docs/reference/classes/CLI.md +67 -0
  25. package/docs/reference/functions/actionCommandTsToOpenApi.md +23 -0
  26. package/docs/reference/functions/buildCommandTsToOpenApi.md +15 -0
  27. package/docs/reference/functions/tsToOpenApi.md +23 -0
  28. package/docs/reference/index.md +16 -0
  29. package/docs/reference/interfaces/ITsToOpenApiConfig.md +79 -0
  30. package/docs/reference/interfaces/ITsToOpenApiConfigEntryPoint.md +27 -0
  31. package/locales/en.json +45 -0
  32. package/package.json +78 -0
@@ -0,0 +1,274 @@
1
+ {
2
+ "error": {
3
+ "commands": {
4
+ "ts-to-openapi": {
5
+ "configFailed": "Configuration failed to load.",
6
+ "missingRestRoutesEntryPoints": "Missing REST routes method \"{method}\" in package \"{package}\".",
7
+ "missingRestRoutesEntryPoint": "Missing REST routes entryPoint \"{entryPoint}\" in package \"{package}\".",
8
+ "unsupportedProperties": "Unsupported properties found in the request object \"{keys}\"."
9
+ },
10
+ "common": {
11
+ "missingEnv": "The \"{option}\" option is configured as an environment variable, but there is no environment variable with the name \"{value}\" set.",
12
+ "optionInvalidHex": "The \"{option}\" does not appear to be hex. \"{value}\"",
13
+ "optionInvalidBase64": "The \"{option}\" does not appear to be base64. \"{value}\"",
14
+ "optionInvalidHexBase64": "The \"{option}\" does not appear to be hex or base64. \"{value}\"",
15
+ "optionInvalidBech32": "The \"{option}\" does not appear to be bech32. \"{value}\"",
16
+ "optionMinValue": "The \"{option}\" option must be greater than or equal to {minValue}, it is {value}.",
17
+ "optionMaxValue": "The \"{option}\" option must be less than or equal to {maxValue}, it is {value}."
18
+ }
19
+ },
20
+ "baseRestClient": {
21
+ "missingRouteProp": "Missing route parameter in data \"{routeProp}\" for route \"{route}\"",
22
+ "decodingFailed": "Decoding JSON failed for route \"{route}\"",
23
+ "failureStatusText": "The request to the API failed: \"{statusText}\""
24
+ },
25
+ "validation": {
26
+ "beEmpty": "{fieldName} must be empty",
27
+ "beNotEmpty": "{fieldName} must not be empty",
28
+ "beText": "{fieldName} must be text",
29
+ "beTextValue": "{fieldName} must contain some text",
30
+ "beTextMinMax": "{fieldName} must be longer than {minLength} and shorter than {maxLength} characters",
31
+ "beTextMin": "{fieldName} must be longer than {minLength} characters",
32
+ "beTextMax": "{fieldName} must be shorter than {maxLength} characters",
33
+ "beNumber": "{fieldName} must be a number",
34
+ "beNumberMinMax": "{fieldName} must be >= {minValue} and <= {maxValue}",
35
+ "beNumberMin": "{fieldName} must be >= {minValue}",
36
+ "beNumberMax": "{fieldName} must be <= {maxValue}",
37
+ "beWholeNumber": "{fieldName} must be a whole number",
38
+ "beWholeNumberMinMax": "{fieldName} must be a whole number >= {minValue} and <= {maxValue}",
39
+ "beWholeNumberMin": "{fieldName} must be a whole number >= {minValue}",
40
+ "beWholeNumberMax": "{fieldName} must be a whole number <= {maxValue}",
41
+ "beBigInteger": "{fieldName} must be a bigint",
42
+ "beBigIntegerMinMax": "{fieldName} must be a bigint >= {minValue} and <= {maxValue}",
43
+ "beBigIntegerMin": "{fieldName} must be a bigint >= {minValue}",
44
+ "beBigIntegerMax": "{fieldName} must be a bigint <= {maxValue}",
45
+ "beBoolean": "{fieldName} must be true or false",
46
+ "beDate": "{fieldName} must be a date",
47
+ "beDateTime": "{fieldName} must be a date/time",
48
+ "beTime": "{fieldName} must be a time",
49
+ "beTimestampMilliseconds": "{fieldName} must be a timestamp in milliseconds",
50
+ "beTimestampSeconds": "{fieldName} must be a timestamp in seconds",
51
+ "beObject": "{fieldName} must be an object",
52
+ "beArray": "{fieldName} must be an array",
53
+ "beArrayValue": "{fieldName} must be an array with at least one item",
54
+ "beIncluded": "{fieldName} is unrecognised",
55
+ "beByteArray": "{fieldName} must be a byte array",
56
+ "beUrn": "{fieldName} must be a correctly formatted urn",
57
+ "beUrl": "{fieldName} must be a correctly formatted url",
58
+ "beJSON": "{fieldName} must be correctly formatted JSON",
59
+ "beEmail": "{fieldName} must be a correctly formatted e-mail address",
60
+ "failed": "Validation failed",
61
+ "failedObject": "Validation of \"{objectName}\" failed"
62
+ },
63
+ "guard": {
64
+ "undefined": "Property \"{property}\" must be defined, it is \"{value}\"",
65
+ "string": "Property \"{property}\" must be a string, it is \"{value}\"",
66
+ "stringEmpty": "Property \"{property}\" must have a value, it is empty",
67
+ "stringBase64": "Property \"{property}\" must be a base64 encoded string, it is \"{value}\"",
68
+ "stringBase64Url": "Property \"{property}\" must be a base64 url encoded string, it is \"{value}\"",
69
+ "stringHex": "Property \"{property}\" must be a hex string, it is \"{value}\"",
70
+ "stringHexLength": "Property \"{property}\" must be a hex string of length \"{options}\", it is \"{value}\"",
71
+ "number": "Property \"{property}\" must be a number, it is \"{value}\"",
72
+ "integer": "Property \"{property}\" must be an integer, it is \"{value}\"",
73
+ "bigint": "Property \"{property}\" must be a bigint, it is \"{value}\"",
74
+ "boolean": "Property \"{property}\" must be a boolean, it is \"{value}\"",
75
+ "date": "Property \"{property}\" must be a date, it is \"{value}\"",
76
+ "timestampMilliseconds": "Property \"{property}\" must be a timestamp in milliseconds, it is \"{value}\"",
77
+ "timestampSeconds": "Property \"{property}\" must be a timestamp in seconds, it is \"{value}\"",
78
+ "objectUndefined": "Property \"{property}\" must be an object, it is \"undefined\"",
79
+ "object": "Property \"{property}\" must be an object, it is \"{value}\"",
80
+ "objectValue": "Property \"{property}\" must be an object, with at least one property, it is \"{value}\"",
81
+ "array": "Property \"{property}\" must be an array, it is \"{value}\"",
82
+ "arrayValue": "Property \"{property}\" must be an array with at least one item",
83
+ "arrayOneOf": "Property \"{property}\" must be one of [{options}], it is \"{value}\"",
84
+ "uint8Array": "Property \"{property}\" must be a Uint8Array, it is \"{value}\"",
85
+ "function": "Property \"{property}\" must be a function, it is \"{value}\"",
86
+ "urn": "Property \"{property}\" must be a Urn formatted string, it is \"{value}\"",
87
+ "url": "Property \"{property}\" must be a Url formatted string, it is \"{value}\"",
88
+ "email": "Property \"{property}\" must be string in e-mail format, it is \"{value}\"",
89
+ "length32Multiple": "Property \"{property}\" should be a multiple of 32, it is {value}",
90
+ "lengthEntropy": "Property \"{property}\" should be a multiple of 4, >=16 and <= 32, it is {value}",
91
+ "length3Multiple": "Property \"{property}\" should be a multiple of 3, it is {value}",
92
+ "greaterThan0": "Property \"{property}\" must be greater than zero, it is {value}"
93
+ },
94
+ "objectHelper": {
95
+ "failedBytesToJSON": "Failed converting bytes to JSON"
96
+ },
97
+ "common": {
98
+ "notImplementedMethod": "The method \"{method}\" has not been implemented",
99
+ "validation": "Validation failed"
100
+ },
101
+ "factory": {
102
+ "noUnregister": "There is no {typeName} registered with the name \"{name}\"",
103
+ "noGet": "The requested {typeName} \"{name}\" does not exist in the factory"
104
+ },
105
+ "bitString": {
106
+ "outOfRange": "The index should be >= 0 and less than the length of the bit string"
107
+ },
108
+ "fetchHelper": {
109
+ "decodingJSON": "Decoding JSON failed for route \"{route}\"",
110
+ "failureStatusText": "The request to the API failed: \"{statusText}\"",
111
+ "connectivity": "The request failed, the API could be offline, or there are other connectivity issues",
112
+ "timeout": "The request timed out",
113
+ "general": "A general failure occurred during the request"
114
+ },
115
+ "jwt": {
116
+ "noKeyOrSigner": "No key or signer was provided for JWT creation",
117
+ "noKeyOrVerifier": "No key or verifier was provided for JWT creation"
118
+ },
119
+ "bip39": {
120
+ "missingMnemonicWord": "The mnemonic contains a word not in the wordlist, \"{value}\"",
121
+ "checksumMismatch": "The checksum does not match \"{newChecksum}\" != \"{checksumBits}\""
122
+ },
123
+ "ed25519": {
124
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
125
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
126
+ },
127
+ "secp256k1": {
128
+ "privateKeyLength": "The private key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\"",
129
+ "publicKeyLength": "The public key length is incorrect, it should be \"{requiredSize}\" but is \"{actualSize}\""
130
+ },
131
+ "x25519": {
132
+ "invalidPublicKey": "Invalid Ed25519 Public Key"
133
+ },
134
+ "blake2b": {
135
+ "outputLength64": "The output length should be between 1 and 64, it is \"{outputLength}\"",
136
+ "keyLength64": "The key length should be between 1 and 64, it is \"{keyLength}\""
137
+ },
138
+ "sha512": {
139
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
140
+ },
141
+ "sha256": {
142
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
143
+ },
144
+ "hmacSha256": {
145
+ "bitSize": "Only 224 or 256 bits are supported, it is \"{bitSize}\""
146
+ },
147
+ "hmacSha512": {
148
+ "bitSize": "Only 224, 256, 384 or 512 bits are supported, it is \"{bitSize}\""
149
+ },
150
+ "base32": {
151
+ "invalidCharacter": "Data contains a character \"{invalidCharacter}\" which is not in the charset"
152
+ },
153
+ "base64": {
154
+ "length4Multiple": "Invalid length should be a multiple of 4, it is \"{value}\""
155
+ },
156
+ "bech32": {
157
+ "decodeFailed": "The address contains decoding failed for address \"{bech32}\"",
158
+ "invalidChecksum": "The address contains an invalid checksum in address, \"{bech32}\"",
159
+ "separatorMisused": "The separator character '1' should only be used between hrp and data, \"{bech32}\"",
160
+ "lowerUpper": "The address my use either lowercase or uppercase, \"{bech32}\"",
161
+ "dataTooShort": "The address does not contain enough data to decode, \"{bech32}\""
162
+ },
163
+ "pbkdf2": {
164
+ "keyTooLong": "The requested key length \"{keyLength}\" is too long, based on the \"{macLength}\""
165
+ },
166
+ "chaCha20Poly1305": {
167
+ "noAadWithData": "You can not set the aad when there is already data",
168
+ "noAuthTag": "Can not finalise when the auth tag is not set",
169
+ "authenticationFailed": "The data could not be authenticated",
170
+ "authTagDecrypting": "Can not get the auth tag when decrypting",
171
+ "authTagEncrypting": "Can not set the auth tag when encrypting",
172
+ "noAuthTagSet": "The auth tag has not been set"
173
+ },
174
+ "bip44": {
175
+ "unsupportedKeyType": "The key type \"{keyType}\" is not supported"
176
+ },
177
+ "slip0010": {
178
+ "invalidSeed": "The seed is invalid \"{seed}\""
179
+ }
180
+ },
181
+ "commands": {
182
+ "ts-to-openapi": {
183
+ "options": {
184
+ "config": {
185
+ "param": "'<'config'>'",
186
+ "description": "Path to the JSON configuration file."
187
+ },
188
+ "output-file": {
189
+ "param": "'<'output-file'>'",
190
+ "description": "The JSON file to write the OpenAPI spec."
191
+ }
192
+ },
193
+ "progress": {
194
+ "loadingConfigJson": "Loading Config JSON",
195
+ "creatingWorkingDir": "Creating Working Directory",
196
+ "creatingSecuritySchemas": "Creating Security Schemas",
197
+ "generatingSchemas": "Generating Schemas",
198
+ "finalisingSchemas": "Finalising Schemas",
199
+ "writingOutputFile": "Writing Output File",
200
+ "models": "Models",
201
+ "installingNpmPackages": "Installing NPM Packages",
202
+ "processingPackage": "Processing Package",
203
+ "importingModule": "Importing Module",
204
+ "processingRoutes": "Processing Routes"
205
+ },
206
+ "labels": {
207
+ "configJson": "Config JSON",
208
+ "outputFile": "Output File",
209
+ "outputWorkingDir": "Output Working Directory",
210
+ "route": "Route"
211
+ }
212
+ }
213
+ },
214
+ "errorNames": {
215
+ "error": "Error",
216
+ "generalError": "General",
217
+ "guardError": "Guard",
218
+ "conflictError": "Conflict",
219
+ "notFoundError": "Not Found",
220
+ "notSupportedError": "Not Supported",
221
+ "alreadyExistsError": "Already Exists",
222
+ "notImplementedError": "Not Implemented",
223
+ "validationError": "Validation",
224
+ "unprocessableError": "Unprocessable"
225
+ },
226
+ "validation": {
227
+ "defaultFieldName": "The field"
228
+ },
229
+ "errorMessages": {
230
+ "fetch": "Fetch"
231
+ },
232
+ "cli": {
233
+ "progress": {
234
+ "done": "Done.",
235
+ "error": "Error",
236
+ "loadingEnvFiles": "Loading env files",
237
+ "pleaseWait": "Please wait...",
238
+ "writingJsonFile": "Writing JSON file",
239
+ "writingEnvFile": "Writing env file",
240
+ "readingJsonFile": "Reading JSON file",
241
+ "readingEnvFile": "Reading env file"
242
+ },
243
+ "options": {
244
+ "lang": {
245
+ "param": "--lang '<'lang'>'",
246
+ "description": "The language to display the output in."
247
+ },
248
+ "load-env": {
249
+ "param": "--load-env [env...]",
250
+ "description": "Load the env files to initialise any environment variables."
251
+ },
252
+ "no-console": {
253
+ "param": "--no-console",
254
+ "description": "Hides the output in the console."
255
+ },
256
+ "json": {
257
+ "param": "--json '<'filename'>'",
258
+ "description": "Creates a JSON file containing the output."
259
+ },
260
+ "env": {
261
+ "param": "--env '<'filename'>'",
262
+ "description": "Creates an env file containing the output."
263
+ },
264
+ "merge-json": {
265
+ "param": "--merge-json",
266
+ "description": "If the JSON file already exists merge the data instead of overwriting."
267
+ },
268
+ "merge-env": {
269
+ "param": "--merge-env",
270
+ "description": "If the env file already exists merge the data instead of overwriting."
271
+ }
272
+ }
273
+ }
274
+ }
@@ -0,0 +1,19 @@
1
+ import { CLIBase } from "@twin.org/cli-core";
2
+ import type { Command } from "commander";
3
+ /**
4
+ * The main entry point for the CLI.
5
+ */
6
+ export declare class CLI extends CLIBase {
7
+ /**
8
+ * Run the app.
9
+ * @param argv The process arguments.
10
+ * @param localesDirectory The directory for the locales, default to relative to the script.
11
+ * @returns The exit code.
12
+ */
13
+ run(argv: string[], localesDirectory?: string): Promise<number>;
14
+ /**
15
+ * Configure any options or actions at the root program level.
16
+ * @param program The root program command.
17
+ */
18
+ protected configureRoot(program: Command): void;
19
+ }
@@ -0,0 +1,20 @@
1
+ import { HttpStatusCode } from "@twin.org/web";
2
+ export declare const HTTP_STATUS_CODE_MAP: {
3
+ [id: string]: {
4
+ code: HttpStatusCode;
5
+ responseType: string;
6
+ example?: unknown;
7
+ };
8
+ };
9
+ /**
10
+ * Get the HTTP status code from the error code type.
11
+ * @param errorCodeType The error code type.
12
+ * @returns The HTTP status code.
13
+ */
14
+ export declare function getHttpStatusCodeFromType(errorCodeType: string): HttpStatusCode;
15
+ /**
16
+ * Get the HTTP example from the error code type.
17
+ * @param errorCodeType The error code type.
18
+ * @returns The example.
19
+ */
20
+ export declare function getHttpExampleFromType(errorCodeType: string): unknown;
@@ -0,0 +1,21 @@
1
+ import type { Command } from "commander";
2
+ import type { ITsToOpenApiConfig } from "../models/ITsToOpenApiConfig";
3
+ /**
4
+ * Build the root command to be consumed by the CLI.
5
+ * @param program The command to build on.
6
+ */
7
+ export declare function buildCommandTsToOpenApi(program: Command): void;
8
+ /**
9
+ * Action the root command.
10
+ * @param configFile The optional configuration file.
11
+ * @param outputFile The output file for the generation OpenApi spec.
12
+ * @param opts The options for the command.
13
+ */
14
+ export declare function actionCommandTsToOpenApi(configFile: string, outputFile: string, opts: unknown): Promise<void>;
15
+ /**
16
+ * Convert the TypeScript definitions to OpenAPI spec.
17
+ * @param config The configuration for the app.
18
+ * @param outputFile The location of the file to output the OpenAPI spec.
19
+ * @param workingDirectory The folder the app was run from.
20
+ */
21
+ export declare function tsToOpenApi(config: ITsToOpenApiConfig, outputFile: string, workingDirectory: string): Promise<void>;
@@ -0,0 +1,4 @@
1
+ export * from "./cli";
2
+ export * from "./commands/tsToOpenApi";
3
+ export * from "./models/ITsToOpenApiConfig";
4
+ export * from "./models/ITsToOpenApiConfigEntryPoint";
@@ -0,0 +1,68 @@
1
+ import type { HttpMethod, HttpStatusCode } from "@twin.org/web";
2
+ /**
3
+ * The resulting details for a REST path.
4
+ */
5
+ export interface IInputPath {
6
+ /**
7
+ * The path.
8
+ */
9
+ path: string;
10
+ /**
11
+ * The REST method.
12
+ */
13
+ method: HttpMethod;
14
+ /**
15
+ * The parameters contained in the path.
16
+ */
17
+ pathParameters: string[];
18
+ /**
19
+ * The id of the operation.
20
+ */
21
+ operationId: string;
22
+ /**
23
+ * Summary of what task the operation performs.
24
+ */
25
+ summary: string;
26
+ /**
27
+ * Tags for the operation.
28
+ */
29
+ tag: string;
30
+ /**
31
+ * The request type.
32
+ */
33
+ requestType?: string;
34
+ /**
35
+ * The request mime type.
36
+ */
37
+ requestMimeType?: string;
38
+ /**
39
+ * Example objects for the request.
40
+ */
41
+ requestExamples?: {
42
+ id: string;
43
+ description?: string;
44
+ request: unknown;
45
+ }[];
46
+ /**
47
+ * The response type.
48
+ */
49
+ responseType: {
50
+ statusCode: HttpStatusCode;
51
+ type: string;
52
+ mimeType?: string;
53
+ description?: string;
54
+ examples?: {
55
+ id: string;
56
+ description?: string;
57
+ response: unknown;
58
+ }[];
59
+ }[];
60
+ /**
61
+ * Response codes.
62
+ */
63
+ responseCodes: string[];
64
+ /**
65
+ * Skip authentication for this path.
66
+ */
67
+ skipAuth: boolean;
68
+ }
@@ -0,0 +1,15 @@
1
+ import type { ITag } from "@twin.org/api-models";
2
+ import type { IInputPath } from "./IInputPath";
3
+ /**
4
+ * The set of path results for a package.
5
+ */
6
+ export interface IInputResult {
7
+ /**
8
+ * The paths.
9
+ */
10
+ paths: IInputPath[];
11
+ /**
12
+ * The tags.
13
+ */
14
+ tags: ITag[];
15
+ }
@@ -0,0 +1,54 @@
1
+ import type { JSONSchema7 } from "json-schema";
2
+ import type { IOpenApiPathMethod } from "./IOpenApiPathMethod";
3
+ import type { IOpenApiSecurityScheme } from "./IOpenApiSecurityScheme";
4
+ /**
5
+ * The Open API config definition.
6
+ */
7
+ export interface IOpenApi {
8
+ /**
9
+ * The open api version.
10
+ */
11
+ openapi: string;
12
+ /**
13
+ * Info.
14
+ */
15
+ info: {
16
+ title: string;
17
+ version: string;
18
+ description: string;
19
+ license?: {
20
+ name: string;
21
+ url: string;
22
+ };
23
+ };
24
+ /**
25
+ * The servers for the endpoints.
26
+ */
27
+ servers?: {
28
+ url: string;
29
+ }[];
30
+ /**
31
+ * Tags for the endpoints.
32
+ */
33
+ tags?: {
34
+ name: string;
35
+ description: string;
36
+ }[];
37
+ /**
38
+ * The paths.
39
+ */
40
+ paths: {
41
+ [path: string]: {
42
+ [method: string]: IOpenApiPathMethod;
43
+ };
44
+ };
45
+ /**
46
+ * The components.
47
+ */
48
+ components?: {
49
+ schemas?: JSONSchema7;
50
+ securitySchemes?: {
51
+ [name: string]: IOpenApiSecurityScheme;
52
+ };
53
+ };
54
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The Open API config definition.
3
+ */
4
+ export interface IOpenApiExample {
5
+ /**
6
+ * The summary of the example.
7
+ */
8
+ summary?: string;
9
+ /**
10
+ * The value of the example.
11
+ */
12
+ value: unknown;
13
+ }
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The Open API config definition.
3
+ */
4
+ export interface IOpenApiHeader {
5
+ /**
6
+ * The schema of the header.
7
+ */
8
+ schema?: {
9
+ type: string;
10
+ };
11
+ /**
12
+ * The description of the header.
13
+ */
14
+ description?: string;
15
+ /**
16
+ * The format of the header.
17
+ */
18
+ format?: string;
19
+ }
@@ -0,0 +1,64 @@
1
+ import type { JSONSchema7Type, JSONSchema7TypeName } from "json-schema";
2
+ import type { IOpenApiExample } from "./IOpenApiExample";
3
+ import type { IOpenApiResponse } from "./IOpenApiResponse";
4
+ /**
5
+ * The Open API config definition.
6
+ */
7
+ export interface IOpenApiPathMethod {
8
+ /**
9
+ * The operation id.
10
+ */
11
+ operationId: string;
12
+ /**
13
+ * Summary.
14
+ */
15
+ summary: string;
16
+ /**
17
+ * Tags.
18
+ */
19
+ tags?: string[];
20
+ /**
21
+ * Parameters.
22
+ */
23
+ parameters?: {
24
+ name: string;
25
+ in: string;
26
+ description?: string;
27
+ required: boolean;
28
+ schema: {
29
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[];
30
+ enum?: JSONSchema7Type[];
31
+ $ref?: string;
32
+ };
33
+ style?: string;
34
+ }[];
35
+ /**
36
+ * Request body.
37
+ */
38
+ requestBody?: {
39
+ required: boolean;
40
+ description?: string;
41
+ content?: {
42
+ [contentType: string]: {
43
+ schema: {
44
+ $ref: string;
45
+ };
46
+ examples?: {
47
+ [id: string]: IOpenApiExample;
48
+ };
49
+ };
50
+ };
51
+ };
52
+ /**
53
+ * Response body.
54
+ */
55
+ responses?: {
56
+ [code: string]: IOpenApiResponse;
57
+ };
58
+ /**
59
+ * Security model for the API.
60
+ */
61
+ security?: {
62
+ [name: string]: string[];
63
+ }[];
64
+ }
@@ -0,0 +1,32 @@
1
+ import type { IOpenApiExample } from "./IOpenApiExample";
2
+ import type { IOpenApiHeader } from "./IOpenApiHeader";
3
+ /**
4
+ * The Open API config definition.
5
+ */
6
+ export interface IOpenApiResponse {
7
+ /**
8
+ * Descriptions for the response.
9
+ */
10
+ description?: string;
11
+ /**
12
+ * Content for the response.
13
+ */
14
+ content?: {
15
+ [contentType: string]: {
16
+ schema: {
17
+ type?: string;
18
+ format?: string;
19
+ $ref?: string;
20
+ };
21
+ examples?: {
22
+ [id: string]: IOpenApiExample;
23
+ };
24
+ };
25
+ };
26
+ /**
27
+ * The headers for the response.
28
+ */
29
+ headers?: {
30
+ [id: string]: IOpenApiHeader;
31
+ };
32
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * The Open API config definition for security scheme.
3
+ */
4
+ export interface IOpenApiSecurityScheme {
5
+ /**
6
+ * The type of the security schema.
7
+ */
8
+ type?: string;
9
+ /**
10
+ * The scheme method.
11
+ */
12
+ scheme?: string;
13
+ /**
14
+ * The bearer format.
15
+ */
16
+ bearerFormat?: string;
17
+ /**
18
+ * Where is the token located.
19
+ */
20
+ in?: string;
21
+ /**
22
+ * What is the name of the token.
23
+ */
24
+ name?: string;
25
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Configuration for each individual package.
3
+ */
4
+ export interface IPackageJson {
5
+ /**
6
+ * The name of the package.
7
+ */
8
+ name: string;
9
+ /**
10
+ * The dependencies for the package.
11
+ */
12
+ dependencies?: {
13
+ [id: string]: string;
14
+ };
15
+ }