treege 3.0.0-beta.68 → 3.0.0-beta.69

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.
@@ -18,8 +18,32 @@ export interface OpenApiDocument {
18
18
  paths: Record<string, OpenApiPathItem | undefined>;
19
19
  components?: {
20
20
  securitySchemes?: Record<string, OpenApiSecurityScheme | undefined>;
21
+ schemas?: Record<string, OpenApiSchema>;
21
22
  };
22
23
  }
24
+ /**
25
+ * Minimal JSON Schema subset — only what's needed to generate a request-body
26
+ * skeleton for a route. Supports `$ref` (to `#/components/schemas/*`), objects,
27
+ * arrays, primitives, and `example`/`default`/`enum` hints.
28
+ */
29
+ export interface OpenApiSchema {
30
+ $ref?: string;
31
+ type?: "object" | "array" | "string" | "number" | "integer" | "boolean" | "null";
32
+ format?: string;
33
+ properties?: Record<string, OpenApiSchema>;
34
+ items?: OpenApiSchema;
35
+ required?: string[];
36
+ enum?: unknown[];
37
+ example?: unknown;
38
+ default?: unknown;
39
+ }
40
+ export interface OpenApiMediaType {
41
+ schema?: OpenApiSchema;
42
+ }
43
+ export interface OpenApiRequestBody {
44
+ required?: boolean;
45
+ content?: Record<string, OpenApiMediaType>;
46
+ }
23
47
  export interface OpenApiPathItem {
24
48
  get?: OpenApiOperation;
25
49
  put?: OpenApiOperation;
@@ -32,6 +56,7 @@ export interface OpenApiOperation {
32
56
  description?: string;
33
57
  tags?: string[];
34
58
  operationId?: string;
59
+ requestBody?: OpenApiRequestBody;
35
60
  }
36
61
  /** HTTP Bearer auth scheme. */
37
62
  export interface OpenApiHttpBearerScheme {
@@ -0,0 +1,12 @@
1
+ import { ApiRouteMethod, OpenApiDocument, OpenApiSchema } from '../types/openapi';
2
+ /**
3
+ * Find the JSON request-body schema for the route matching `url` + `method`,
4
+ * or `undefined` when the route has no JSON request body.
5
+ */
6
+ export declare const findRouteRequestSchema: (doc: OpenApiDocument, url: string, method: ApiRouteMethod) => OpenApiSchema | undefined;
7
+ /**
8
+ * Build a JSON skeleton from a schema: uses `example`/`default`/`enum` when
9
+ * present, otherwise a typed placeholder (`""`, `0`, `false`, `{}`, `[…]`).
10
+ * `$ref`s are resolved against `components.schemas`; cyclic refs are cut off.
11
+ */
12
+ export declare const buildPayloadSkeleton: (doc: OpenApiDocument, schema: OpenApiSchema | undefined, seenRefs?: Set<string>) => unknown;