@veluai/velu 0.1.14 → 0.1.16
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/dist/cli.js +44 -23
- package/package.json +2 -1
- package/runtime/velu-ui/components/ApiClient.jsx +84 -8
- package/runtime/velu-ui/components/ApiReferencePage.jsx +388 -0
- package/runtime/velu-ui/components/ApiSamples.jsx +36 -0
- package/runtime/velu-ui/components/Logo.jsx +31 -0
- package/runtime/velu-ui/components/PageFooter.jsx +6 -74
- package/runtime/velu-ui/components/PageHeader.jsx +10 -2
- package/runtime/velu-ui/components/Sidebar.jsx +10 -2
- package/runtime/velu-ui/components/SocialLinks.jsx +90 -0
- package/runtime/velu-ui/components/TryItBar.jsx +15 -3
- package/runtime/velu-ui/components/api-page.css +215 -0
- package/runtime/velu-ui/components/api.css +117 -1
- package/runtime/velu-ui/components/page-footer.css +5 -5
- package/runtime/velu-ui/components/page-header.css +37 -0
- package/runtime/velu-ui/components/powered-by.css +20 -0
- package/runtime/velu-ui/index.js +4 -0
- package/runtime/velu-ui/lib/api-send.js +92 -0
- package/runtime/velu-ui/styles.css +1 -0
- package/schema/velu.schema.json +160 -0
- package/src/navigation.js +11 -2
- package/src/runtime/App.jsx +109 -66
- package/templates/starter/api-reference/introduction.mdx +29 -14
- package/templates/starter/openapi.json +160 -0
- package/templates/starter/velu.json +6 -2
- package/templates/starter/api-reference/endpoint/create.mdx +0 -24
- package/templates/starter/api-reference/endpoint/get.mdx +0 -27
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Product Catalog API",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "A friendly, fully-hosted example API — a product catalog backed by the live https://dummyjson.com service. Every operation hits the real API: list, search, fetch, create, update and delete products and see real responses."
|
|
7
|
+
},
|
|
8
|
+
"servers": [{ "url": "https://dummyjson.com" }],
|
|
9
|
+
"tags": [{ "name": "Products", "description": "Browse and manage the product catalog." }],
|
|
10
|
+
"paths": {
|
|
11
|
+
"/products": {
|
|
12
|
+
"get": {
|
|
13
|
+
"operationId": "listProducts",
|
|
14
|
+
"summary": "List products",
|
|
15
|
+
"description": "List products, with optional pagination.",
|
|
16
|
+
"tags": ["Products"],
|
|
17
|
+
"parameters": [
|
|
18
|
+
{ "name": "limit", "in": "query", "schema": { "type": "integer" }, "description": "How many products to return (0 returns all)." },
|
|
19
|
+
{ "name": "skip", "in": "query", "schema": { "type": "integer" }, "description": "How many products to skip (for pagination)." }
|
|
20
|
+
],
|
|
21
|
+
"responses": {
|
|
22
|
+
"200": {
|
|
23
|
+
"description": "A page of products.",
|
|
24
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductList" } } }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"/products/search": {
|
|
30
|
+
"get": {
|
|
31
|
+
"operationId": "searchProducts",
|
|
32
|
+
"summary": "Search products",
|
|
33
|
+
"description": "Search the catalog by a free-text query.",
|
|
34
|
+
"tags": ["Products"],
|
|
35
|
+
"parameters": [
|
|
36
|
+
{ "name": "q", "in": "query", "required": true, "schema": { "type": "string" }, "description": "The search query (try `phone`)." }
|
|
37
|
+
],
|
|
38
|
+
"responses": {
|
|
39
|
+
"200": {
|
|
40
|
+
"description": "Matching products.",
|
|
41
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductList" } } }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"/products/{id}": {
|
|
47
|
+
"get": {
|
|
48
|
+
"operationId": "getProduct",
|
|
49
|
+
"summary": "Get a product",
|
|
50
|
+
"description": "Retrieve a single product by its id.",
|
|
51
|
+
"tags": ["Products"],
|
|
52
|
+
"parameters": [
|
|
53
|
+
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "The product id (try `1`)." }
|
|
54
|
+
],
|
|
55
|
+
"responses": {
|
|
56
|
+
"200": {
|
|
57
|
+
"description": "The product.",
|
|
58
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"put": {
|
|
63
|
+
"operationId": "updateProduct",
|
|
64
|
+
"summary": "Update a product",
|
|
65
|
+
"description": "Update fields on an existing product. (Simulated by the upstream API — the response reflects the change but nothing is persisted.)",
|
|
66
|
+
"tags": ["Products"],
|
|
67
|
+
"parameters": [
|
|
68
|
+
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "The product id." }
|
|
69
|
+
],
|
|
70
|
+
"requestBody": {
|
|
71
|
+
"required": true,
|
|
72
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductInput" } } }
|
|
73
|
+
},
|
|
74
|
+
"responses": {
|
|
75
|
+
"200": {
|
|
76
|
+
"description": "The updated product.",
|
|
77
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
"delete": {
|
|
82
|
+
"operationId": "deleteProduct",
|
|
83
|
+
"summary": "Delete a product",
|
|
84
|
+
"description": "Delete a product by its id. (Simulated — the response includes `isDeleted` and `deletedOn`.)",
|
|
85
|
+
"tags": ["Products"],
|
|
86
|
+
"parameters": [
|
|
87
|
+
{ "name": "id", "in": "path", "required": true, "schema": { "type": "integer" }, "description": "The product id." }
|
|
88
|
+
],
|
|
89
|
+
"responses": {
|
|
90
|
+
"200": {
|
|
91
|
+
"description": "The deleted product.",
|
|
92
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"/products/add": {
|
|
98
|
+
"post": {
|
|
99
|
+
"operationId": "addProduct",
|
|
100
|
+
"summary": "Add a product",
|
|
101
|
+
"description": "Create a new product. (Simulated — the response echoes the body with a fresh `id`.)",
|
|
102
|
+
"tags": ["Products"],
|
|
103
|
+
"requestBody": {
|
|
104
|
+
"required": true,
|
|
105
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/ProductInput" } } }
|
|
106
|
+
},
|
|
107
|
+
"responses": {
|
|
108
|
+
"201": {
|
|
109
|
+
"description": "The created product.",
|
|
110
|
+
"content": { "application/json": { "schema": { "$ref": "#/components/schemas/Product" } } }
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"components": {
|
|
117
|
+
"schemas": {
|
|
118
|
+
"Product": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"id": { "type": "integer", "description": "Unique identifier." },
|
|
122
|
+
"title": { "type": "string", "description": "Product name." },
|
|
123
|
+
"description": { "type": "string", "description": "Product description." },
|
|
124
|
+
"category": { "type": "string", "description": "Category slug." },
|
|
125
|
+
"price": { "type": "number", "description": "Price in USD." },
|
|
126
|
+
"discountPercentage": { "type": "number", "description": "Discount, as a percentage." },
|
|
127
|
+
"rating": { "type": "number", "description": "Average customer rating (0–5)." },
|
|
128
|
+
"stock": { "type": "integer", "description": "Units in stock." },
|
|
129
|
+
"brand": { "type": "string", "description": "Brand name." },
|
|
130
|
+
"thumbnail": { "type": "string", "description": "Thumbnail image URL." }
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"ProductList": {
|
|
134
|
+
"type": "object",
|
|
135
|
+
"properties": {
|
|
136
|
+
"products": { "type": "array", "description": "The products on this page.", "items": { "$ref": "#/components/schemas/Product" } },
|
|
137
|
+
"total": { "type": "integer", "description": "Total number of matching products." },
|
|
138
|
+
"skip": { "type": "integer", "description": "How many were skipped." },
|
|
139
|
+
"limit": { "type": "integer", "description": "How many were returned." }
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
"ProductInput": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": ["title"],
|
|
145
|
+
"properties": {
|
|
146
|
+
"title": { "type": "string", "description": "Product name." },
|
|
147
|
+
"description": { "type": "string", "description": "Product description." },
|
|
148
|
+
"category": { "type": "string", "description": "Category slug." },
|
|
149
|
+
"price": { "type": "number", "description": "Price in USD." }
|
|
150
|
+
},
|
|
151
|
+
"example": {
|
|
152
|
+
"title": "Velu Notebook",
|
|
153
|
+
"description": "A dotted-grid notebook for docs notes.",
|
|
154
|
+
"category": "stationery",
|
|
155
|
+
"price": 19.99
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
@@ -23,11 +23,15 @@
|
|
|
23
23
|
{
|
|
24
24
|
"tab": "API Reference",
|
|
25
25
|
"icon": "terminal",
|
|
26
|
+
"openapi": "/openapi.json",
|
|
26
27
|
"groups": [
|
|
27
|
-
{ "group": "API Documentation", "pages": ["api-reference/introduction"] }
|
|
28
|
-
{ "group": "Endpoint Examples", "pages": ["api-reference/endpoint/get", "api-reference/endpoint/create"] }
|
|
28
|
+
{ "group": "API Documentation", "pages": ["api-reference/introduction"] }
|
|
29
29
|
]
|
|
30
30
|
}
|
|
31
31
|
]
|
|
32
|
+
},
|
|
33
|
+
"api": {
|
|
34
|
+
"playground": { "proxy": true },
|
|
35
|
+
"examples": { "languages": ["curl", "javascript", "python", "ruby"] }
|
|
32
36
|
}
|
|
33
37
|
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Create item
|
|
3
|
-
description: Create a new item.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<MethodBadge method="POST" /> `/items`
|
|
7
|
-
|
|
8
|
-
Creates an item and returns it.
|
|
9
|
-
|
|
10
|
-
## Body
|
|
11
|
-
|
|
12
|
-
<ApiField name="name" type="string" required>
|
|
13
|
-
Display name for the item.
|
|
14
|
-
</ApiField>
|
|
15
|
-
|
|
16
|
-
## Response
|
|
17
|
-
|
|
18
|
-
```json
|
|
19
|
-
{
|
|
20
|
-
"id": "itm_2",
|
|
21
|
-
"name": "New item",
|
|
22
|
-
"created_at": "2024-01-01T00:00:00Z"
|
|
23
|
-
}
|
|
24
|
-
```
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Get items
|
|
3
|
-
description: Retrieve a list of items.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
<MethodBadge method="GET" /> `/items`
|
|
7
|
-
|
|
8
|
-
Returns a paginated list of items.
|
|
9
|
-
|
|
10
|
-
## Query parameters
|
|
11
|
-
|
|
12
|
-
<ApiField name="limit" type="integer" default="20">
|
|
13
|
-
Maximum number of items to return.
|
|
14
|
-
</ApiField>
|
|
15
|
-
|
|
16
|
-
<ApiField name="cursor" type="string">
|
|
17
|
-
Pagination cursor from a previous response.
|
|
18
|
-
</ApiField>
|
|
19
|
-
|
|
20
|
-
## Response
|
|
21
|
-
|
|
22
|
-
```json
|
|
23
|
-
{
|
|
24
|
-
"data": [{ "id": "itm_1", "name": "Example" }],
|
|
25
|
-
"next_cursor": null
|
|
26
|
-
}
|
|
27
|
-
```
|