oas-truth 0.0.3 → 0.1.0
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/dist/index.d.ts +5 -7
- package/dist/index.js +1 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
2
1
|
//#region src/openapi/index.d.ts
|
|
3
2
|
export declare function parseOpenAPI(input: string): Promise<{
|
|
4
3
|
readonly ok: true;
|
|
@@ -9,8 +8,7 @@ export declare function parseOpenAPI(input: string): Promise<{
|
|
|
9
8
|
readonly ok: false;
|
|
10
9
|
readonly error: string;
|
|
11
10
|
}>;
|
|
12
|
-
type
|
|
13
|
-
export type OpenAPI = BaseOpenAPI & {
|
|
11
|
+
export type OpenAPI = {
|
|
14
12
|
readonly openapi?: string;
|
|
15
13
|
readonly $self?: string;
|
|
16
14
|
readonly info?: {
|
|
@@ -32,7 +30,7 @@ export type OpenAPI = BaseOpenAPI & {
|
|
|
32
30
|
};
|
|
33
31
|
readonly jsonSchemaDialect?: string;
|
|
34
32
|
readonly servers?: readonly Server[];
|
|
35
|
-
readonly paths:
|
|
33
|
+
readonly paths: OpenAPIPaths;
|
|
36
34
|
readonly webhooks?: {
|
|
37
35
|
readonly [k: string]: PathItem;
|
|
38
36
|
};
|
|
@@ -49,8 +47,6 @@ export type OpenAPI = BaseOpenAPI & {
|
|
|
49
47
|
readonly kind?: string;
|
|
50
48
|
}[];
|
|
51
49
|
readonly externalDocs?: ExternalDocs;
|
|
52
|
-
} & {
|
|
53
|
-
paths: OpenAPIPaths;
|
|
54
50
|
};
|
|
55
51
|
export type Components = {
|
|
56
52
|
readonly schemas?: {
|
|
@@ -120,7 +116,9 @@ type OAuthFlow = {
|
|
|
120
116
|
};
|
|
121
117
|
};
|
|
122
118
|
};
|
|
123
|
-
export type OpenAPIPaths = {
|
|
119
|
+
export type OpenAPIPaths = {
|
|
120
|
+
readonly [k: string]: PathItem;
|
|
121
|
+
};
|
|
124
122
|
export type Type = 'string' | 'number' | 'integer' | 'date' | 'boolean' | 'array' | 'object' | 'null';
|
|
125
123
|
export type Format = FormatString | FormatNumber;
|
|
126
124
|
export type FormatString = 'email' | 'uuid' | 'uuidv4' | 'uuidv6' | 'uuidv7' | 'url' | 'uri' | 'httpUrl' | 'hostname' | 'hex' | 'jwt' | 'emoji' | 'base64' | 'base64url' | 'nanoid' | 'cuid' | 'cuid2' | 'ulid' | 'ipv4' | 'ipv6' | 'cidrv4' | 'cidrv6' | 'date' | 'time' | 'date-time' | 'duration' | 'binary' | 'byte' | 'password' | 'mac' | 'hash' | 'e164' | 'guid' | 'toLowerCase' | 'toUpperCase' | 'trim';
|
package/dist/index.js
CHANGED
|
@@ -18,10 +18,9 @@ async function parseOpenAPI(input) {
|
|
|
18
18
|
};
|
|
19
19
|
const [record] = await getOpenAPI3(program);
|
|
20
20
|
const tsp = "document" in record ? record.document : record.versions[0].document;
|
|
21
|
-
const document = JSON.parse(JSON.stringify(tsp));
|
|
22
21
|
return {
|
|
23
22
|
ok: true,
|
|
24
|
-
value: await SwaggerParser.bundle(
|
|
23
|
+
value: await SwaggerParser.bundle(tsp)
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
return {
|