@vercube/schema 0.0.34 โ†’ 0.0.35

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 (3) hide show
  1. package/README.md +21 -126
  2. package/dist/index.mjs +2 -2
  3. package/package.json +6 -6
package/README.md CHANGED
@@ -1,145 +1,40 @@
1
1
  <div align="center">
2
- <a href="https://vercube.dev/"><img src="https://github.com/OskarLebuda/vue-lazy-hydration/raw/main/.github/assets/logo.png?raw=true" alt="Vite logo" width="200"></a>
2
+ <img src="https://raw.githubusercontent.com/vercube/vercube/refs/heads/main/.github/assets/cover.png" width="100%" alt="Vercube - Unleash your server development." />
3
3
  <br>
4
4
  <br>
5
5
 
6
- # Vercube
6
+ # @vercube/schema
7
7
 
8
- Next generation HTTP framework
8
+ ### OpenAPI schema generation for Vercube
9
9
 
10
- <a href="https://www.npmjs.com/package/@vercube/schema">
11
- <img src="https://img.shields.io/npm/v/%40vercube%2Fschema?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
12
- </a>
13
- <a href="https://www.npmjs.com/package/@vercube/schema">
14
- <img src="https://img.shields.io/npm/dm/%40vercube%2Fschema?style=for-the-badge&logo=npm&color=%23767eff" alt="npm"/>
15
- </a>
16
- <a href="https://github.com/vercube/vercube/blob/main/LICENSE" target="_blank">
17
- <img src="https://img.shields.io/npm/l/%40vercube%2Fschema?style=for-the-badge&color=%23767eff" alt="License"/>
18
- </a>
19
- <a href="https://codecov.io/gh/vercube/vercube" target="_blank">
20
- <img src="https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&color=%23767eff" alt="Coverage"/>
21
- </a>
22
- <br/>
23
- <br/>
24
- </div>
25
-
26
- An ultra-efficient JavaScript server framework that runs anywhere - Node.js, Bun, or Deno - with unmatched flexibility and complete configurability for developers who refuse to sacrifice speed or control.
10
+ [![Ask DeepWiki](<https://img.shields.io/badge/ask-deepwiki-%20blue?style=for-the-badge&logo=bookstack&logoColor=rgba(255%2C%20255%2C%20255%2C%200.6)&labelColor=%23000&color=%232f2f2f>)](https://deepwiki.com/vercube/vercube)
11
+ ![NPM Version](<https://img.shields.io/npm/v/%40vercube%2Fschema?style=for-the-badge&logo=npm&logoColor=rgba(255%2C%20255%2C%20255%2C%200.6)&labelColor=%23000&color=%232e2e2e&link=https%3A%2F%2Fwww.npmjs.com%2Fpackage%2F%40vercube%2Fschema>)
12
+ ![GitHub License](<https://img.shields.io/github/license/vercube/vercube?style=for-the-badge&logo=gitbook&logoColor=rgba(255%2C%20255%2C%20255%2C%200.6)&labelColor=%23000&color=%232f2f2f>)
13
+ ![Codecov](<https://img.shields.io/codecov/c/github/vercube/vercube?style=for-the-badge&logo=vitest&logoColor=rgba(255%2C%20255%2C%20255%2C%200.6)&labelColor=%23000&color=%232f2f2f>)
27
14
 
28
- ---
15
+ **Auto-generate OpenAPI specs from your Zod schemas. Add `@Schema` to your routes, get Swagger docs at `/_schema`.**
29
16
 
30
- ## ๐Ÿงฉ `@vercube/schema` Module
17
+ [Website](https://vercube.dev) โ€ข [Documentation](https://vercube.dev/docs/getting-started)
31
18
 
32
- The `@vercube/schema` module provides a unified, provider-agnostic interface for managing OpenAPI schemas.
33
- It abstracts schema definitions into a consistent API that works across tools and environments, enabling easy switching between providers without modifying your application code.
34
-
35
- ### โœ… Key Features
19
+ </div>
36
20
 
37
- - Seamless integration with OpenAPI
38
- - Zod-based schema definition
39
- - Works out-of-the-box with route decorators
40
- - Compatible with custom validation and metadata
41
- - Supports both static and runtime schema generation
21
+ ## โœจ Features
42
22
 
43
- ---
23
+ - **Zod-based** - define schemas once, use for validation AND docs
24
+ - **Decorator API** - `@Schema` on routes to add OpenAPI metadata
25
+ - **Auto-resolution** - picks up `@Body`, `@Param`, `@QueryParams` automatically
26
+ - **Runtime endpoint** - OpenAPI JSON available at `/_schema`
44
27
 
45
- ## ๐Ÿš€ Installation
28
+ ## ๐Ÿ“ฆ Installation
46
29
 
47
30
  ```bash
48
- pnpm install @vercube/schema
49
- ```
50
-
51
- ---
52
-
53
- ## โš™๏ธ Usage
54
-
55
- Integrate the Schema plugin into your app setup:
56
-
57
- ```ts
58
- import { createApp } from '@vercube/core';
59
- import { SchemaPlugin } from '@vercube/schema';
60
-
61
- const app = createApp({
62
- setup: async (app) => {
63
- app.addPlugin(SchemaPlugin);
64
- },
65
- });
66
- ```
67
-
68
- ---
69
-
70
- ## ๐Ÿงต Route Schema Decorators
71
-
72
- The `@Schema` decorator lets you define OpenAPI-compatible schema definitions directly on your routes.
73
- It leverages [`@asteasolutions/zod-to-openapi`](https://github.com/asteasolutions/zod-to-openapi) for automatic schema translation and also supports `.openapi` properties on Zod schemas.
74
-
75
- ```ts
76
- import { Body, Controller, Post } from '@vercube/core';
77
- import { Schema } from '@vercube/schema';
78
-
79
- @Controller('/users')
80
- export class UsersController {
81
- @Post('/')
82
- @Schema({
83
- request: {
84
- params: ParamsSchema,
85
- },
86
- responses: {
87
- 200: {
88
- description: 'Retrieve the user',
89
- content: {
90
- 'application/json': {
91
- schema: UserSchema,
92
- },
93
- },
94
- },
95
- },
96
- })
97
- public async insertUser(@Body({ validationSchema: UserSchema }) user: User): Promise<void> {
98
- console.log(user);
99
- }
100
- }
31
+ pnpm add @vercube/schema
101
32
  ```
102
33
 
103
- ## ๐Ÿ“„ Runtime Access to OpenAPI Schema
104
-
105
- When the SchemaPlugin is added to your application, a special controller is automatically registered.
106
- This controller exposes the full OpenAPI schema at runtime and is available without any additional configuration.
107
-
108
- You can access it at:
109
-
110
- ```
111
- http://localhost:3000/_schema
112
- ```
113
-
114
- This makes it easy to integrate with tools like Swagger UI, Postman, or for debugging and documentation purposes.
115
-
116
- ### โœจ Automatic Resolution
117
-
118
- - The `@Schema` decorator automatically resolves:
119
- - HTTP method and route path
120
- - Request body schema (`@Body`)
121
- - Query parameters (`@QueryParams`)
122
- - Path parameters (`@Params`)
123
-
124
- ---
125
-
126
- ## ๐Ÿ“š Documentation
127
-
128
- Full documentation is available at [**vercube.dev**](https://vercube.dev).
129
- Explore guides, API references, and best practices to master Vercube.
130
-
131
- ---
132
-
133
- ## ๐Ÿ™Œ Credits
134
-
135
- This module is inspired by:
136
-
137
- - [@asteasolutions/zod-to-openapi](https://github.com/asteasolutions/zod-to-openapi)
138
- - [Hono Zod OpenAPI Example](https://hono.dev/examples/zod-openapi)
139
- - [Nitro OpenAPI](https://nitro.build/config#openapi)
34
+ ## ๐Ÿ“– Documentation
140
35
 
141
- ---
36
+ Check out the full docs at **[vercube.dev](https://vercube.dev)**
142
37
 
143
- ## ๐Ÿชช License
38
+ ## ๐Ÿ“œ License
144
39
 
145
- [MIT License](https://github.com/vercube/vercube/blob/main/LICENSE)
40
+ [MIT](https://github.com/vercube/vercube/blob/main/LICENSE)
package/dist/index.mjs CHANGED
@@ -71,7 +71,7 @@ var SchemaRegistry = class {
71
71
  };
72
72
 
73
73
  //#endregion
74
- //#region \0@oxc-project+runtime@0.99.0/helpers/decorate.js
74
+ //#region \0@oxc-project+runtime@0.110.0/helpers/decorate.js
75
75
  function __decorate(decorators, target, key, desc) {
76
76
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
77
77
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -121,7 +121,7 @@ function Schema(params) {
121
121
 
122
122
  //#endregion
123
123
  //#region src/Controllers/SchameController.ts
124
- let SchemaController = class SchemaController$1 {
124
+ let SchemaController = class SchemaController {
125
125
  gSchemaRegistry;
126
126
  /**
127
127
  * Handles GET requests to retrieve the generated OpenAPI schema.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercube/schema",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "Schema (swagger) module for Vercube framework",
5
5
  "repository": {
6
6
  "type": "git",
@@ -27,12 +27,12 @@
27
27
  "swagger"
28
28
  ],
29
29
  "dependencies": {
30
- "@asteasolutions/zod-to-openapi": "8.1.0",
31
- "@standard-schema/spec": "1.0.0",
30
+ "@asteasolutions/zod-to-openapi": "8.4.0",
31
+ "@standard-schema/spec": "1.1.0",
32
32
  "defu": "6.1.4",
33
- "zod": "4.1.13",
34
- "@vercube/core": "0.0.34",
35
- "@vercube/di": "0.0.34"
33
+ "zod": "4.3.6",
34
+ "@vercube/di": "0.0.35",
35
+ "@vercube/core": "0.0.35"
36
36
  },
37
37
  "publishConfig": {
38
38
  "access": "public"