@zudojs/openapi 1.3.0 → 1.5.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.
Files changed (35) hide show
  1. package/README.md +83 -2
  2. package/dist/index.d.ts +10 -6
  3. package/dist/index.js +8 -4
  4. package/dist/openApiConstants/index.d.ts +1 -1
  5. package/dist/openApiConstants/index.js +1 -1
  6. package/dist/openApiConstants/openApiConstants.core.d.ts +5 -0
  7. package/dist/openApiConstants/openApiConstants.core.js +5 -0
  8. package/dist/openApiFromRoutes/index.d.ts +11 -0
  9. package/dist/openApiFromRoutes/index.js +10 -0
  10. package/dist/openApiFromRoutes/openApiFromRoutes.document.d.ts +43 -0
  11. package/dist/openApiFromRoutes/openApiFromRoutes.document.js +64 -0
  12. package/dist/openApiFromRoutes/openApiFromRoutes.type.d.ts +56 -0
  13. package/dist/openApiFromRoutes/openApiFromRoutes.type.js +5 -0
  14. package/dist/openApiHttp/openApiHttpAdapter.core.d.ts +28 -1
  15. package/dist/openApiHttp/openApiHttpAdapter.core.js +40 -1
  16. package/dist/openApiRouting/index.d.ts +3 -1
  17. package/dist/openApiRouting/index.js +2 -0
  18. package/dist/openApiRouting/routeContent.core.d.ts +22 -0
  19. package/dist/openApiRouting/routeContent.core.js +101 -0
  20. package/dist/openApiRouting/routeConverter.core.d.ts +11 -5
  21. package/dist/openApiRouting/routeConverter.core.js +23 -28
  22. package/dist/openApiRouting/routeMetadata.type.d.ts +36 -2
  23. package/dist/openApiRouting/routeScanner.core.d.ts +7 -3
  24. package/dist/openApiRouting/routeScanner.core.js +46 -10
  25. package/dist/openApiRouting/routeSchema.core.d.ts +19 -0
  26. package/dist/openApiRouting/routeSchema.core.js +93 -0
  27. package/dist/openApiSchema/index.d.ts +1 -0
  28. package/dist/openApiSchema/index.js +1 -0
  29. package/dist/openApiSchema/schemaConverter.core.d.ts +2 -0
  30. package/dist/openApiSchema/schemaConverter.core.js +9 -4
  31. package/dist/openApiSchema/schemaInput.core.d.ts +28 -0
  32. package/dist/openApiSchema/schemaInput.core.js +36 -0
  33. package/dist/openApiSchema/schemaInput.type.d.ts +48 -0
  34. package/dist/openApiSchema/schemaInput.type.js +5 -0
  35. package/package.json +7 -6
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Schema-bearing inputs a route or operation may declare.
3
+ */
4
+ import type { OpenAPIHeader, OpenAPIReference, OpenAPISchema } from "../openApiTypes/openApiTypes.core.js";
5
+ import type { SchemaInputOptions } from "./schemaInput.core.js";
6
+ /**
7
+ * A schema a route may declare: a `@zudojs/schema` schema (anything carrying
8
+ * a string `_type`, converted with `convertSchema` for the document's
9
+ * version), or an OpenAPI Schema / Reference Object used as-is.
10
+ */
11
+ export type OpenAPISchemaInput = OpenAPISchema | OpenAPIReference | {
12
+ readonly _type: string;
13
+ };
14
+ /**
15
+ * A request body declared by schema rather than as a raw Request Body Object.
16
+ */
17
+ export interface OpenAPIRouteBody {
18
+ /** The body's schema. */
19
+ readonly schema: OpenAPISchemaInput;
20
+ /** Media type(s) the body is accepted as. Default: `application/json`. */
21
+ readonly contentType?: string | readonly string[];
22
+ /** Whether the body is required. Default: `true`. */
23
+ readonly required?: boolean;
24
+ readonly description?: string;
25
+ readonly example?: unknown;
26
+ }
27
+ /**
28
+ * A response declared by schema rather than as a raw Response Object.
29
+ *
30
+ * An entry in `responses` is read as this shape when it has a `schema` key;
31
+ * otherwise it is an OpenAPI Response Object and passes through unchanged.
32
+ */
33
+ export interface OpenAPIRouteResponse {
34
+ /** The response body's schema. */
35
+ readonly schema: OpenAPISchemaInput;
36
+ /** Default: the status code's reason phrase, e.g. "Not Found". */
37
+ readonly description?: string;
38
+ /** Media type(s) the body is sent as. Default: `application/json`. */
39
+ readonly contentType?: string | readonly string[];
40
+ readonly headers?: Readonly<Record<string, OpenAPIHeader>>;
41
+ readonly example?: unknown;
42
+ }
43
+ /**
44
+ * Options for converting a route into an operation: the version declared
45
+ * schemas are converted for, and a sink for what they could not express.
46
+ */
47
+ export type RouteConversionOptions = SchemaInputOptions;
48
+ //# sourceMappingURL=schemaInput.type.d.ts.map
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Schema-bearing inputs a route or operation may declare.
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=schemaInput.type.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zudojs/openapi",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "OpenAPI 3.0 and 3.1 specification generation, validation, and serialization for Zudojs applications.",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -26,13 +26,14 @@
26
26
  "!dist/.tsbuildinfo"
27
27
  ],
28
28
  "dependencies": {
29
- "@zudojs/constants": "1.1.0",
30
- "@zudojs/errors": "1.1.0"
29
+ "@zudojs/constants": "1.1.2",
30
+ "@zudojs/errors": "1.3.0"
31
31
  },
32
32
  "devDependencies": {
33
- "@types/node": "^26.4.1",
33
+ "@types/node": "^26.6.2",
34
+ "@zudojs/schema": "1.2.0",
34
35
  "typescript": "7.0.2",
35
- "vitest": "^4.1.11"
36
+ "vitest": "^5.0.1"
36
37
  },
37
38
  "engines": {
38
39
  "node": ">=24.0.0"
@@ -46,7 +47,7 @@
46
47
  "swagger",
47
48
  "api-docs"
48
49
  ],
49
- "homepage": "https://github.com/oyinlola-tech/zudo#readme",
50
+ "homepage": "https://zudojs.oyinlola.site/docs/packages-openapi",
50
51
  "bugs": {
51
52
  "url": "https://github.com/oyinlola-tech/zudo/issues"
52
53
  },