@tetsujs/openapi 0.4.1 → 0.4.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.
package/README.md CHANGED
@@ -30,6 +30,38 @@ reported before the first request.
30
30
  prefix, guard it with hooks, or leave it out in production. Its own two
31
31
  routes are left out of the document.
32
32
 
33
+ ### The page runs someone else's code on your origin
34
+
35
+ The page loads its renderer — Scalar, Swagger UI or Redoc — from
36
+ jsDelivr and runs it on the application's origin, with that origin's
37
+ cookies. If a session cookie lives there, a renderer that is not what it
38
+ should be acts as the signed-in user. The defaults are pinned to an exact
39
+ version with a Subresource Integrity hash, so a file the CDN changes is
40
+ refused by the browser; that does not make the renderer yours, and what it
41
+ loads in turn is not covered.
42
+
43
+ Where the origin carries a session, serve the document alone:
44
+
45
+ ```ts
46
+ docs({ info, ui: false });
47
+ ```
48
+
49
+ `/openapi.json` is served and there is no page. For a page anyway, host
50
+ the renderer yourself or pin your own copy, with its hash:
51
+
52
+ ```ts
53
+ docs({
54
+ info,
55
+ assets: {
56
+ script: "https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.72.1/dist/browser/standalone.js",
57
+ integrity: { script: "sha384-…" },
58
+ },
59
+ });
60
+ ```
61
+
62
+ `curl -s <url> | openssl dgst -sha384 -binary | openssl base64 -A` prints
63
+ the hash, to be prefixed with `sha384-`.
64
+
33
65
  ## Options
34
66
 
35
67
  | Option | Default | |
@@ -38,9 +70,9 @@ routes are left out of the document.
38
70
  | `servers` | — | where the API is reachable |
39
71
  | `path` | `/openapi.json` | where the document is served |
40
72
  | `uiPath` | `/docs` | where the page is served |
41
- | `ui` | `"scalar"` | `"scalar"`, `"swagger-ui"` or `"redoc"` |
73
+ | `ui` | `"scalar"` | `"scalar"`, `"swagger-ui"`, `"redoc"`, or `false` for no page |
42
74
  | `title` | the document's title | the page's title |
43
- | `assets` | the renderer's CDN | pinned or self-hosted renderer URLs |
75
+ | `assets` | the renderer on jsDelivr, pinned | your own renderer URLs, with `integrity` hashes |
44
76
  | `documentSelf` | `false` | include `/openapi.json` and `/docs` in the document |
45
77
  | `onWarning` | `console.warn` | receives what could not be described |
46
78
 
@@ -106,6 +138,19 @@ The `error` code is a constant in each schema, so a generated client can
106
138
  tell failures apart by it. A status the route declares itself is kept, and
107
139
  the framework's failures for the same status are listed next to it.
108
140
 
141
+ Every envelope — the framework's, a hook's, or one the route declares
142
+ itself — is one definition in `components` per status and code, named
143
+ after the code (`ITEM_NOT_FOUND` is `ItemNotFound`), so a generated client
144
+ gets one type per failure. A schema is recognized as an envelope when its
145
+ `error` is required and a single string. When the route and a hook both
146
+ describe one code, the route's definition is kept; if the other one has
147
+ different fields, the generator warns. A union the route declares joins
148
+ the other failures of its status as one flat `anyOf`.
149
+
150
+ When every alternative of a status is an envelope, the union carries a
151
+ `discriminator` on `error`, with the mapping from each code to its
152
+ definition, and a generated client narrows on the code.
153
+
109
154
  ## Documenting hooks
110
155
 
111
156
  A hook that answers by itself — an auth check, a limiter — can say so, and
@@ -127,10 +172,25 @@ export const auth = secured(
127
172
  );
128
173
 
129
174
  export const guard = documented(hook.beforeParse(check), {
130
- responses: [{ status: 429, description: "Rate limit exceeded", error: "RATE_LIMITED" }],
175
+ responses: [
176
+ {
177
+ status: 429,
178
+ description: "Rate limit exceeded",
179
+ error: "RATE_LIMITED",
180
+ fields: { retryAfter: { type: "integer", minimum: 0 } },
181
+ headers: { "retry-after": { schema: { type: "integer", minimum: 0 } } },
182
+ },
183
+ ],
131
184
  });
132
185
  ```
133
186
 
187
+ A response with an `error` code is the framework's envelope, defined once
188
+ in `components` and named after the code. `fields` adds what the hook puts
189
+ next to `status`, `message` and `error`, each always present; `headers`,
190
+ what it sets on the response. Both are JSON Schema written by hand, typed
191
+ keyword by keyword (`JsonSchema`), so a misspelled keyword does not
192
+ compile. A hook whose body is not the envelope passes a `schema` instead.
193
+
134
194
  Hooks from `@tetsujs/rate-limit` are already documented this way. A scheme
135
195
  is identified by its `name`: the same one mounted twice is one
136
196
  requirement, and two different schemes under one name are reported.
@@ -16,6 +16,7 @@
16
16
  * @module
17
17
  */
18
18
  import type { AnyHook, AnySchema } from "@tetsujs/core";
19
+ import type { JsonSchema } from "./json-schema.ts";
19
20
  /**
20
21
  * The definition of a scheme, as OpenAPI spells it.
21
22
  *
@@ -70,6 +71,45 @@ export interface DocumentedResponse {
70
71
  readonly error?: string;
71
72
  /** An example of the envelope's `message`, for the same reason. */
72
73
  readonly message?: string;
74
+ /**
75
+ * Fields the hook adds to the envelope, as JSON Schema by name — the
76
+ * `retryAfter` of `{ ...errorBody(429, "RATE_LIMITED"), retryAfter }`.
77
+ *
78
+ * Each is documented as always present. The envelope's own `status`,
79
+ * `message` and `error` are not redefined by a field of the same name:
80
+ * `error` is what a client discriminates on, and it stays the code the
81
+ * hook declared. Ignored when the response has a `schema`, which says
82
+ * everything about the body itself.
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * documented(limiter, {
87
+ * responses: [
88
+ * {
89
+ * status: 429,
90
+ * description: "Too many requests",
91
+ * error: "RATE_LIMITED",
92
+ * fields: { retryAfter: { type: "integer", minimum: 0 } },
93
+ * },
94
+ * ],
95
+ * });
96
+ * ```
97
+ */
98
+ readonly fields?: Readonly<Record<string, JsonSchema>>;
99
+ /**
100
+ * Headers the hook sets on this response, by name — the `retry-after`
101
+ * of a refusal.
102
+ *
103
+ * Documented as possible rather than required: a status several sources
104
+ * answer with is one response in the document, and a header one of them
105
+ * sets is not on the others'.
106
+ */
107
+ readonly headers?: Readonly<Record<string, DocumentedHeader>>;
108
+ }
109
+ /** A header a hook's response carries. */
110
+ export interface DocumentedHeader {
111
+ readonly description?: string;
112
+ readonly schema: JsonSchema;
73
113
  }
74
114
  /**
75
115
  * Requirements of which a hook accepts any one: a session cookie *or* a
@@ -1 +1 @@
1
- {"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../../src/annotations.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OA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AGG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAElD;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC,SAAS,mBAAmB,EAAE,CAAC,EAAE,CAAC;IAEjE,QAAQ,CAAC,SAAS,EAAE,SAAS,kBAAkB,EAAE,CAAC;CACnD;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,OAAO,EAAE,CAAC,EAC1C,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC/B,iBAAiB,CAsDnB"}
@@ -18,7 +18,7 @@ import type { OpenApiDocument } from "./document.ts";
18
18
  import type { GeneratorWarning } from "./index.ts";
19
19
  import type { DocsAssets, DocsUi } from "./page.ts";
20
20
  /** What the documentation controller serves, and from where. */
21
- export interface DocsOptions<Path extends string, UiPath extends string> {
21
+ export interface DocsOptions<Path extends string, UiPath extends string, Ui extends DocsUi | false = DocsUi | false> {
22
22
  /** Title, version and the rest of the document's `info` block. */
23
23
  readonly info: OpenApiDocument["info"];
24
24
  /** Servers the API is reachable at. */
@@ -27,8 +27,16 @@ export interface DocsOptions<Path extends string, UiPath extends string> {
27
27
  readonly path?: Path & ValidatePath<Path>;
28
28
  /** Where the page is served. Defaults to `/docs`. */
29
29
  readonly uiPath?: UiPath & ValidatePath<UiPath>;
30
- /** Which renderer the page bootstraps. Defaults to `"scalar"`. */
31
- readonly ui?: DocsUi;
30
+ /**
31
+ * Which renderer the page bootstraps. Defaults to `"scalar"`.
32
+ *
33
+ * `false` serves the document without a page — what production wants
34
+ * on an origin that carries a session. The page runs its renderer on the
35
+ * application's origin, so a renderer that is not what it should be acts
36
+ * in the signed-in user's name there; the document alone runs nothing.
37
+ * `uiPath`, `title` and `assets` are then unused.
38
+ */
39
+ readonly ui?: Ui;
32
40
  /** Browser title of the page. Defaults to the document's own title. */
33
41
  readonly title?: string;
34
42
  /** Overrides the renderer's CDN URLs, for a pinned or self-hosted copy. */
@@ -56,15 +64,24 @@ export interface DocsOptions<Path extends string, UiPath extends string> {
56
64
  * Instantiated through the factory, never directly — the routes carry the
57
65
  * configured paths in their types, which only the factory can infer.
58
66
  */
59
- export declare class DocsController<Path extends string, UiPath extends string> {
67
+ export declare class DocsController<Path extends string, UiPath extends string, Page extends boolean = true> {
60
68
  private readonly options;
61
69
  /** The document itself, as `application/json`. */
62
70
  readonly json: RouteDef<Path, SchemaConfig, never, undefined, "GET">;
63
- /** The page that renders it. */
64
- readonly ui: RouteDef<UiPath, SchemaConfig, never, undefined, "GET">;
71
+ /** The page that renders it — none with `ui: false`. */
72
+ readonly ui: Page extends true ? RouteDef<UiPath, SchemaConfig, never, undefined, "GET"> : undefined;
65
73
  private document;
66
- constructor(options: DocsOptions<Path, UiPath>, documentPath: string, uiPath: string, page: string);
67
- /** Generates the document of the application this was mounted in. */
74
+ private page;
75
+ constructor(options: DocsOptions<Path, UiPath>, documentPath: string, uiPath: string);
76
+ /**
77
+ * Generates the document of the application this was mounted in, and
78
+ * the page that renders it.
79
+ *
80
+ * The page is built here rather than with the routes because only the
81
+ * application knows where the document ended up: a group this controller
82
+ * is mounted under prefixes its path, and a page pointing at the path as
83
+ * configured would fetch a `404`.
84
+ */
68
85
  [onMount](app: App): void;
69
86
  }
70
87
  /**
@@ -87,5 +104,5 @@ export declare class DocsController<Path extends string, UiPath extends string>
87
104
  * The page loads its renderer from a CDN; see {@link docsPage} for the
88
105
  * trade and for how to point it at a self-hosted copy.
89
106
  */
90
- export declare function docs<const Path extends string = "/openapi.json", const UiPath extends string = "/docs">(options: DocsOptions<Path, UiPath>): DocsController<Path, UiPath>;
107
+ export declare function docs<const Path extends string = "/openapi.json", const UiPath extends string = "/docs", const Ui extends DocsUi | false = "scalar">(options: DocsOptions<Path, UiPath, Ui>): DocsController<Path, UiPath, Ui extends false ? false : true>;
91
108
  //# sourceMappingURL=controller.d.ts.map
@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AAwD;IACxD,QAAQ,CAAC,EAAE,EAAE,IAAI,SAAS,IAAI,GAC1B,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,GACvD,SAAS,CAAC;IAEd,OAAO,CAAC,QAAQ,CAA8B;IAE9C,OAAO,CAAC,IAAI,CAAqB;IAEjC,YACmB,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,CAAC,EACnD,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,EAkCf;IAED;;;;;;;;OAQG;IACH,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,CA0BxB;CACF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,IAAI,CAClB,KAAK,CAAC,IAAI,SAAS,MAAM,GAAG,eAAe,EAC3C,KAAK,CAAC,MAAM,SAAS,MAAM,GAAG,OAAO,EACrC,KAAK,CAAC,EAAE,SAAS,MAAM,GAAG,KAAK,GAAG,QAAQ,EAE1C,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,GACrC,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,SAAS,KAAK,GAAG,KAAK,GAAG,IAAI,CAAC,CAM/D"}
@@ -14,6 +14,7 @@
14
14
  *
15
15
  * @module
16
16
  */
17
+ import type { JsonSchema } from "./json-schema.ts";
17
18
  /** Metadata every OpenAPI document must carry. */
18
19
  export interface DocumentInfo {
19
20
  readonly title: string;
@@ -38,9 +39,15 @@ export interface ParameterObject {
38
39
  export type ContentMap = Record<string, {
39
40
  readonly schema?: Record<string, unknown>;
40
41
  }>;
42
+ /** A header a response carries. */
43
+ export interface HeaderObject {
44
+ readonly description?: string;
45
+ readonly schema: JsonSchema;
46
+ }
41
47
  /** One response of an operation. */
42
48
  export interface ResponseObject {
43
49
  readonly description: string;
50
+ readonly headers?: Record<string, HeaderObject>;
44
51
  readonly content?: ContentMap;
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AE/C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE;QACpB,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KAC5C,CAAC;IAEF,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC"}
@@ -6,13 +6,15 @@
6
6
  * @module
7
7
  */
8
8
  /**
9
- * A JSON Schema as the generator reads it: any keyword, with the two it
9
+ * A JSON Schema as the generator reads it: any keyword, with the ones it
10
10
  * looks into named, so reading them does not depend on the reader's
11
11
  * `noPropertyAccessFromIndexSignature`.
12
12
  */
13
13
  export interface JsonSchemaObject {
14
14
  properties?: unknown;
15
15
  required?: unknown;
16
+ anyOf?: unknown;
17
+ oneOf?: unknown;
16
18
  [keyword: string]: unknown;
17
19
  }
18
20
  /** Which shape of a schema to describe: what arrives, or what leaves. */
@@ -1 +1 @@
1
- {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/emit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,yEAAyE;AACzE,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAC/B,SAAS,GAAE,SAAoB,GAC9B,gBAAgB,GAAG,SAAS,CAkB9B"}
1
+ {"version":3,"file":"emit.d.ts","sourceRoot":"","sources":["../../src/emit.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED,yEAAyE;AACzE,KAAK,SAAS,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpC;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,OAAO,CACrB,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,EAC/B,SAAS,GAAE,SAAoB,GAC9B,gBAAgB,GAAG,SAAS,CAkB9B"}
@@ -0,0 +1,74 @@
1
+ /**
2
+ * Error envelopes, one definition per status and code.
3
+ *
4
+ * An envelope reaches a document from four directions: a route's response
5
+ * map, a hook's annotation, a guard's security requirement, and the
6
+ * framework's own failures. Each used to be described where it arrived —
7
+ * a route's inline, the rest by reference — so one `UNAUTHORIZED` could be
8
+ * listed twice under one status, once as a `$ref` and once as the same
9
+ * shape without a name, and a generated client got a named type next to an
10
+ * anonymous twin.
11
+ *
12
+ * Here every envelope, whoever declared it, becomes a reference to the
13
+ * one definition of its status and code. That is also what makes a status
14
+ * discriminable: a client can branch on `error` only if every code under
15
+ * the status has exactly one shape.
16
+ *
17
+ * The route's definition wins. It is the author's own contract — usually
18
+ * the stricter one, a validator's `additionalProperties: false` — where a
19
+ * hook's is the framework's generic envelope. The routes are therefore
20
+ * read first, before any operation is built, so the winner does not depend
21
+ * on which route happens to come first in the table.
22
+ *
23
+ * Internal to the package.
24
+ *
25
+ * @module
26
+ */
27
+ import type { SchemaComponents, SchemaRef } from "./components.ts";
28
+ import type { JsonSchemaObject } from "./emit.ts";
29
+ /** The definitions of every envelope of one document. */
30
+ export interface Envelopes {
31
+ /**
32
+ * Records a route's definition, before anything is referenced. The first
33
+ * route to declare a status and code defines it.
34
+ */
35
+ declare(status: number, code: string, schema: JsonSchemaObject): void;
36
+ /**
37
+ * The reference to the definition of a status and code.
38
+ *
39
+ * `schema` is how the caller describes it. When a definition already
40
+ * exists, that is what is referenced; if the caller's differs from it
41
+ * in fields, `warn` hears about it — once per document, not once per
42
+ * operation the hook runs on.
43
+ */
44
+ ref(status: number, code: string, schema: JsonSchemaObject, warn: (message: string) => void): SchemaRef;
45
+ /**
46
+ * The code a reference stands for, when it is one this handed out — what
47
+ * a discriminator maps back from.
48
+ */
49
+ codeOf(ref: string): string | undefined;
50
+ }
51
+ export declare function envelopes(components: SchemaComponents): Envelopes;
52
+ /**
53
+ * The error code of a schema that is an envelope: an object whose `error`
54
+ * is required and holds one string — a `const`, or an `enum` of one value.
55
+ *
56
+ * Read off what the validator emitted, not off a declaration: the route
57
+ * has no other way to say which of its responses is an envelope, and the
58
+ * shape is what a client would branch on anyway.
59
+ */
60
+ export declare function envelopeCode(schema: JsonSchemaObject): string | undefined;
61
+ /**
62
+ * The alternatives a schema stands for, as a list the status's own union
63
+ * can take in.
64
+ *
65
+ * `anyOf` nested in `anyOf` says nothing its branches do not say side by
66
+ * side, so a schema that is only an `anyOf` is replaced by its branches.
67
+ * A `oneOf` is different — "exactly one" of two overlapping shapes refuses
68
+ * what both accept — and is taken apart only when its branches cannot
69
+ * overlap: envelopes with a different code each. A schema with anything
70
+ * beside its union, a `title` or a `$defs`, is left whole: those keywords
71
+ * belong to the union, and would be lost with it.
72
+ */
73
+ export declare function branchesOf(schema: JsonSchemaObject): JsonSchemaObject[];
74
+ //# sourceMappingURL=envelopes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"envelopes.d.ts","sourceRoot":"","sources":["../../src/envelopes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,yDAAyD;AACzD,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAAC;IAEtE;;;;;;;OAOG;IACH,GAAG,CACD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GAC9B,SAAS,CAAC;IAEb;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACzC;AAED,wBAAgB,SAAS,CAAC,UAAU,EAAE,gBAAgB,GAAG,SAAS,CAoEjE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,GAAG,SAAS,CA0BzE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,CAwBvE"}
@@ -20,11 +20,12 @@
20
20
  */
21
21
  import type { App } from "@tetsujs/core";
22
22
  import type { OpenApiDocument } from "./document.ts";
23
- export type { DocumentedResponse, HookContributions, HookDocs, SecurityAlternatives, SecurityRequirement, SecurityScheme, } from "./annotations.ts";
23
+ export type { DocumentedHeader, DocumentedResponse, HookContributions, HookDocs, SecurityAlternatives, SecurityRequirement, SecurityScheme, } from "./annotations.ts";
24
24
  export { documented, secured } from "./annotations.ts";
25
25
  export type { DocsOptions } from "./controller.ts";
26
26
  export { DocsController, docs } from "./controller.ts";
27
- export type { ContentMap, DocumentInfo, DocumentServer, OpenApiDocument, OperationObject, ParameterObject, PathItemObject, ResponseObject, } from "./document.ts";
27
+ export type { ContentMap, DocumentInfo, DocumentServer, HeaderObject, OpenApiDocument, OperationObject, ParameterObject, PathItemObject, ResponseObject, } from "./document.ts";
28
+ export type { JsonSchema, JsonSchemaKeywords, JsonSchemaType, } from "./json-schema.ts";
28
29
  export type { DocsAssets, DocsPageOptions, DocsUi } from "./page.ts";
29
30
  export { docsPage } from "./page.ts";
30
31
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,KAAK,EAAE,eAAe,EAAkB,MAAM,eAAe,CAAC;AAIrE,YAAY,EACV,kBAAkB,EAClB,iBAAiB,EACjB,QAAQ,EACR,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvD,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAErC;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAEvC,uCAAuC;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,CAAC;CAC/C;AAED;;;;;;;GAOG;AACH,M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