@trpc/openapi 0.0.0-alpha.0 → 11.13.2-alpha
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/LICENSE +21 -0
- package/README.md +14 -0
- package/dist/cli.js +937 -0
- package/dist/heyapi/index.cjs +141 -0
- package/dist/heyapi/index.d.cts +67 -0
- package/dist/heyapi/index.d.cts.map +1 -0
- package/dist/heyapi/index.d.mts +67 -0
- package/dist/heyapi/index.d.mts.map +1 -0
- package/dist/heyapi/index.mjs +139 -0
- package/dist/heyapi/index.mjs.map +1 -0
- package/dist/index.cjs +834 -0
- package/dist/index.d.cts +63 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +63 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +835 -0
- package/dist/index.mjs.map +1 -0
- package/dist/objectSpread2-Cw30I7tb.cjs +131 -0
- package/dist/objectSpread2-UxrN8MPM.mjs +114 -0
- package/dist/objectSpread2-UxrN8MPM.mjs.map +1 -0
- package/package.json +101 -1
- package/src/cli.ts +133 -0
- package/src/generate.ts +1265 -0
- package/src/heyapi/index.ts +174 -0
- package/src/index.ts +2 -0
- package/src/schemaExtraction.ts +383 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/generate.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A minimal JSON Schema subset used for OpenAPI 3.1 schemas.
|
|
4
|
+
*/
|
|
5
|
+
interface JsonSchema {
|
|
6
|
+
$ref?: string;
|
|
7
|
+
$defs?: Record<string, JsonSchema>;
|
|
8
|
+
type?: string | string[];
|
|
9
|
+
properties?: Record<string, JsonSchema>;
|
|
10
|
+
required?: string[];
|
|
11
|
+
items?: JsonSchema | false;
|
|
12
|
+
prefixItems?: JsonSchema[];
|
|
13
|
+
const?: string | number | boolean | null;
|
|
14
|
+
enum?: (string | number | boolean | null)[];
|
|
15
|
+
oneOf?: JsonSchema[];
|
|
16
|
+
anyOf?: JsonSchema[];
|
|
17
|
+
allOf?: JsonSchema[];
|
|
18
|
+
not?: JsonSchema;
|
|
19
|
+
additionalProperties?: JsonSchema | boolean;
|
|
20
|
+
discriminator?: {
|
|
21
|
+
propertyName: string;
|
|
22
|
+
mapping?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
format?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
minItems?: number;
|
|
27
|
+
maxItems?: number;
|
|
28
|
+
$schema?: string;
|
|
29
|
+
}
|
|
30
|
+
interface GenerateOptions {
|
|
31
|
+
/**
|
|
32
|
+
* The name of the exported router symbol.
|
|
33
|
+
* @default 'AppRouter'
|
|
34
|
+
*/
|
|
35
|
+
exportName?: string;
|
|
36
|
+
/** Title for the generated OpenAPI `info` object. */
|
|
37
|
+
title?: string;
|
|
38
|
+
/** Version string for the generated OpenAPI `info` object. */
|
|
39
|
+
version?: string;
|
|
40
|
+
}
|
|
41
|
+
interface OpenAPIDocument {
|
|
42
|
+
openapi: string;
|
|
43
|
+
jsonSchemaDialect?: string;
|
|
44
|
+
info: {
|
|
45
|
+
title: string;
|
|
46
|
+
version: string;
|
|
47
|
+
};
|
|
48
|
+
paths: Record<string, Record<string, unknown>>;
|
|
49
|
+
components: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Analyse the given TypeScript router file using the TypeScript compiler and
|
|
53
|
+
* return an OpenAPI 3.1 document describing all query and mutation procedures.
|
|
54
|
+
*
|
|
55
|
+
* @param routerFilePath - Absolute or relative path to the file that exports
|
|
56
|
+
* the AppRouter.
|
|
57
|
+
* @param options - Optional generation settings (export name, title, version).
|
|
58
|
+
*/
|
|
59
|
+
declare function generateOpenAPIDocument(routerFilePath: string, options?: GenerateOptions): Promise<OpenAPIDocument>;
|
|
60
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
61
|
+
//#endregion
|
|
62
|
+
export { GenerateOptions, JsonSchema, OpenAPIDocument, generateOpenAPIDocument };
|
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AQ"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//#region src/generate.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* A minimal JSON Schema subset used for OpenAPI 3.1 schemas.
|
|
4
|
+
*/
|
|
5
|
+
interface JsonSchema {
|
|
6
|
+
$ref?: string;
|
|
7
|
+
$defs?: Record<string, JsonSchema>;
|
|
8
|
+
type?: string | string[];
|
|
9
|
+
properties?: Record<string, JsonSchema>;
|
|
10
|
+
required?: string[];
|
|
11
|
+
items?: JsonSchema | false;
|
|
12
|
+
prefixItems?: JsonSchema[];
|
|
13
|
+
const?: string | number | boolean | null;
|
|
14
|
+
enum?: (string | number | boolean | null)[];
|
|
15
|
+
oneOf?: JsonSchema[];
|
|
16
|
+
anyOf?: JsonSchema[];
|
|
17
|
+
allOf?: JsonSchema[];
|
|
18
|
+
not?: JsonSchema;
|
|
19
|
+
additionalProperties?: JsonSchema | boolean;
|
|
20
|
+
discriminator?: {
|
|
21
|
+
propertyName: string;
|
|
22
|
+
mapping?: Record<string, string>;
|
|
23
|
+
};
|
|
24
|
+
format?: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
minItems?: number;
|
|
27
|
+
maxItems?: number;
|
|
28
|
+
$schema?: string;
|
|
29
|
+
}
|
|
30
|
+
interface GenerateOptions {
|
|
31
|
+
/**
|
|
32
|
+
* The name of the exported router symbol.
|
|
33
|
+
* @default 'AppRouter'
|
|
34
|
+
*/
|
|
35
|
+
exportName?: string;
|
|
36
|
+
/** Title for the generated OpenAPI `info` object. */
|
|
37
|
+
title?: string;
|
|
38
|
+
/** Version string for the generated OpenAPI `info` object. */
|
|
39
|
+
version?: string;
|
|
40
|
+
}
|
|
41
|
+
interface OpenAPIDocument {
|
|
42
|
+
openapi: string;
|
|
43
|
+
jsonSchemaDialect?: string;
|
|
44
|
+
info: {
|
|
45
|
+
title: string;
|
|
46
|
+
version: string;
|
|
47
|
+
};
|
|
48
|
+
paths: Record<string, Record<string, unknown>>;
|
|
49
|
+
components: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Analyse the given TypeScript router file using the TypeScript compiler and
|
|
53
|
+
* return an OpenAPI 3.1 document describing all query and mutation procedures.
|
|
54
|
+
*
|
|
55
|
+
* @param routerFilePath - Absolute or relative path to the file that exports
|
|
56
|
+
* the AppRouter.
|
|
57
|
+
* @param options - Optional generation settings (export name, title, version).
|
|
58
|
+
*/
|
|
59
|
+
declare function generateOpenAPIDocument(routerFilePath: string, options?: GenerateOptions): Promise<OpenAPIDocument>;
|
|
60
|
+
//# sourceMappingURL=generate.d.ts.map
|
|
61
|
+
//#endregion
|
|
62
|
+
export { GenerateOptions, JsonSchema, OpenAPIDocument, generateOpenAPIDocument };
|
|
63
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/generate.ts"],"sourcesContent":[],"mappings":";;AAcA;;AAEyB,UAFR,UAAA,CAEQ;EAAU,IAAzB,CAAA,EAAA,MAAA;EAAM,KAEc,CAAA,EAFpB,MAEoB,CAAA,MAAA,EAFL,UAEK,CAAA;EAAU,IAAzB,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAAM,UAEX,CAAA,EAFK,MAEL,CAAA,MAAA,EAFoB,UAEpB,CAAA;EAAU,QACJ,CAAA,EAAA,MAAA,EAAA;EAAU,KAGhB,CAAA,EAJA,UAIA,GAAA,KAAA;EAAU,WACV,CAAA,EAJM,UAIN,EAAA;EAAU,KACV,CAAA,EAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA;EAAU,IACZ,CAAA,EAAA,CAAA,MAAA,GAAA,MAAA,GAAA,OAAA,GAAA,IAAA,CAAA,EAAA;EAAU,KACO,CAAA,EAJf,UAIe,EAAA;EAAU,KACiB,CAAA,EAJ1C,UAI0C,EAAA;EAAM,KAAA,CAAA,EAHhD,UAGgD,EAAA;EA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