specra-cli 0.3.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.
- package/LICENSE.MD +33 -0
- package/README.md +246 -0
- package/dist/api-client-VHQARPDT.js +15 -0
- package/dist/api-client-VHQARPDT.js.map +1 -0
- package/dist/chunk-5765WX4D.js +192 -0
- package/dist/chunk-5765WX4D.js.map +1 -0
- package/dist/chunk-72RDEJR2.js +94 -0
- package/dist/chunk-72RDEJR2.js.map +1 -0
- package/dist/chunk-SQ2MMFUZ.js +102 -0
- package/dist/chunk-SQ2MMFUZ.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +242 -0
- package/dist/cli.js.map +1 -0
- package/dist/deploy-V4JO2D6B.js +179 -0
- package/dist/deploy-V4JO2D6B.js.map +1 -0
- package/dist/doctor-ICALAJ4N.js +309 -0
- package/dist/doctor-ICALAJ4N.js.map +1 -0
- package/dist/login-UG3WU7DY.js +92 -0
- package/dist/login-UG3WU7DY.js.map +1 -0
- package/dist/logout-WJKHJZT6.js +24 -0
- package/dist/logout-WJKHJZT6.js.map +1 -0
- package/dist/logs-BLUJPWNO.js +77 -0
- package/dist/logs-BLUJPWNO.js.map +1 -0
- package/dist/projects-LJ57GK3D.js +49 -0
- package/dist/projects-LJ57GK3D.js.map +1 -0
- package/package.json +50 -0
- package/templates/book-docs/.env.sample +1 -0
- package/templates/book-docs/docs/v1.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v1.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v1.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v1.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v1.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v1.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v1.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v1.0.0/introduction.mdx +38 -0
- package/templates/book-docs/docs/v1.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/docs/v2.0.0/concepts.mdx +89 -0
- package/templates/book-docs/docs/v2.0.0/content/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/content/formatting.mdx +128 -0
- package/templates/book-docs/docs/v2.0.0/content/reusable-content.mdx +116 -0
- package/templates/book-docs/docs/v2.0.0/content/structure.mdx +92 -0
- package/templates/book-docs/docs/v2.0.0/customization/_category_.json +7 -0
- package/templates/book-docs/docs/v2.0.0/customization/branding.mdx +115 -0
- package/templates/book-docs/docs/v2.0.0/customization/themes.mdx +81 -0
- package/templates/book-docs/docs/v2.0.0/introduction.mdx +39 -0
- package/templates/book-docs/docs/v2.0.0/quickstart.mdx +112 -0
- package/templates/book-docs/gitignore +7 -0
- package/templates/book-docs/package.json +28 -0
- package/templates/book-docs/postcss.config.mjs +8 -0
- package/templates/book-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/book-docs/public/api-specs/postman-example.json +205 -0
- package/templates/book-docs/public/api-specs/test-api.json +256 -0
- package/templates/book-docs/public/api-specs/users-api.json +264 -0
- package/templates/book-docs/specra.config.json +77 -0
- package/templates/book-docs/src/app.css +86 -0
- package/templates/book-docs/src/app.html +17 -0
- package/templates/book-docs/src/params/product.ts +7 -0
- package/templates/book-docs/src/routes/+layout.server.ts +14 -0
- package/templates/book-docs/src/routes/+layout.svelte +21 -0
- package/templates/book-docs/src/routes/+page.server.ts +9 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/book-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/book-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/book-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/book-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/book-docs/static/favicon.svg +4 -0
- package/templates/book-docs/svelte.config.js +13 -0
- package/templates/book-docs/tsconfig.json +12 -0
- package/templates/book-docs/vite.config.ts +6 -0
- package/templates/jbrains-docs/.env.sample +1 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v1.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v1.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v1.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v1.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v1.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/async.mdx +95 -0
- package/templates/jbrains-docs/docs/v2.0.0/advanced/generics.mdx +126 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/control-flow.mdx +106 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/syntax.mdx +129 -0
- package/templates/jbrains-docs/docs/v2.0.0/basics/types.mdx +135 -0
- package/templates/jbrains-docs/docs/v2.0.0/getting-started.mdx +111 -0
- package/templates/jbrains-docs/docs/v2.0.0/home.mdx +37 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/_category_.json +8 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/build-tools.mdx +165 -0
- package/templates/jbrains-docs/docs/v2.0.0/tools/testing.mdx +112 -0
- package/templates/jbrains-docs/gitignore +7 -0
- package/templates/jbrains-docs/package.json +28 -0
- package/templates/jbrains-docs/postcss.config.mjs +8 -0
- package/templates/jbrains-docs/public/api-specs/openapi-example.json +259 -0
- package/templates/jbrains-docs/public/api-specs/postman-example.json +205 -0
- package/templates/jbrains-docs/public/api-specs/test-api.json +256 -0
- package/templates/jbrains-docs/public/api-specs/users-api.json +264 -0
- package/templates/jbrains-docs/specra.config.json +80 -0
- package/templates/jbrains-docs/src/app.css +86 -0
- package/templates/jbrains-docs/src/app.html +17 -0
- package/templates/jbrains-docs/src/params/product.ts +7 -0
- package/templates/jbrains-docs/src/routes/+layout.server.ts +14 -0
- package/templates/jbrains-docs/src/routes/+layout.svelte +21 -0
- package/templates/jbrains-docs/src/routes/+page.server.ts +9 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/jbrains-docs/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/jbrains-docs/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/jbrains-docs/static/favicon.svg +4 -0
- package/templates/jbrains-docs/svelte.config.js +13 -0
- package/templates/jbrains-docs/tsconfig.json +12 -0
- package/templates/jbrains-docs/vite.config.ts +6 -0
- package/templates/minimal/.env.sample +1 -0
- package/templates/minimal/docs/v1.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v1.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v1.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v1.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v1.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v1.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v1.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v1.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v1.0.0/getting-started.mdx +183 -0
- package/templates/minimal/docs/v2.0.0/about.mdx +57 -0
- package/templates/minimal/docs/v2.0.0/components/_category_.json +8 -0
- package/templates/minimal/docs/v2.0.0/components/callout.mdx +83 -0
- package/templates/minimal/docs/v2.0.0/components/code-block.mdx +103 -0
- package/templates/minimal/docs/v2.0.0/components/index.mdx +8 -0
- package/templates/minimal/docs/v2.0.0/components/tabs.mdx +92 -0
- package/templates/minimal/docs/v2.0.0/configuration.mdx +322 -0
- package/templates/minimal/docs/v2.0.0/features.mdx +197 -0
- package/templates/minimal/docs/v2.0.0/getting-started.mdx +183 -0
- package/templates/minimal/gitignore +7 -0
- package/templates/minimal/package.json +29 -0
- package/templates/minimal/postcss.config.mjs +8 -0
- package/templates/minimal/specra.config.json +91 -0
- package/templates/minimal/src/app.css +86 -0
- package/templates/minimal/src/app.html +17 -0
- package/templates/minimal/src/hooks.server.ts +8 -0
- package/templates/minimal/src/params/product.ts +7 -0
- package/templates/minimal/src/routes/+error.svelte +10 -0
- package/templates/minimal/src/routes/+layout.server.ts +14 -0
- package/templates/minimal/src/routes/+layout.svelte +21 -0
- package/templates/minimal/src/routes/+page.server.ts +9 -0
- package/templates/minimal/src/routes/+page.svelte +149 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+layout.server.ts +40 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/+page.server.ts +24 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.server.ts +131 -0
- package/templates/minimal/src/routes/docs/[product=product]/[version]/[...slug]/+page.svelte +180 -0
- package/templates/minimal/src/routes/docs/[version]/+layout.server.ts +42 -0
- package/templates/minimal/src/routes/docs/[version]/+page.server.ts +27 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.server.ts +106 -0
- package/templates/minimal/src/routes/docs/[version]/[...slug]/+page.svelte +172 -0
- package/templates/minimal/static/api-specs/openapi-example.json +259 -0
- package/templates/minimal/static/api-specs/postman-example.json +205 -0
- package/templates/minimal/static/api-specs/test-api.json +256 -0
- package/templates/minimal/static/api-specs/users-api.json +264 -0
- package/templates/minimal/static/favicon.svg +4 -0
- package/templates/minimal/svelte.config.js +13 -0
- package/templates/minimal/tsconfig.json +12 -0
- package/templates/minimal/vite.config.ts +6 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Testing
|
|
3
|
+
description: Verify your documentation builds and renders correctly
|
|
4
|
+
sidebar_position: 2
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
This page covers strategies for testing your documentation site to ensure content renders correctly and the build succeeds.
|
|
8
|
+
|
|
9
|
+
## Build Verification
|
|
10
|
+
|
|
11
|
+
The simplest test is to run a production build and check for errors:
|
|
12
|
+
|
|
13
|
+
<Tabs defaultValue="npm">
|
|
14
|
+
<Tab label="npm">
|
|
15
|
+
```bash
|
|
16
|
+
npm run build
|
|
17
|
+
```
|
|
18
|
+
</Tab>
|
|
19
|
+
<Tab label="yarn">
|
|
20
|
+
```bash
|
|
21
|
+
yarn build
|
|
22
|
+
```
|
|
23
|
+
</Tab>
|
|
24
|
+
<Tab label="pnpm">
|
|
25
|
+
```bash
|
|
26
|
+
pnpm build
|
|
27
|
+
```
|
|
28
|
+
</Tab>
|
|
29
|
+
</Tabs>
|
|
30
|
+
|
|
31
|
+
The build will fail if:
|
|
32
|
+
- MDX files have syntax errors
|
|
33
|
+
- Frontmatter is malformed
|
|
34
|
+
- Required fields are missing
|
|
35
|
+
|
|
36
|
+
<Callout type="tip">
|
|
37
|
+
Run `npm run build` in your CI pipeline to catch documentation errors before they reach production.
|
|
38
|
+
</Callout>
|
|
39
|
+
|
|
40
|
+
## Type Checking
|
|
41
|
+
|
|
42
|
+
Verify TypeScript types are correct:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm run check
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This catches type errors in your SvelteKit configuration and any custom components.
|
|
49
|
+
|
|
50
|
+
## Content Checklist
|
|
51
|
+
|
|
52
|
+
When reviewing documentation changes, verify:
|
|
53
|
+
|
|
54
|
+
| Check | Description |
|
|
55
|
+
|-------|-------------|
|
|
56
|
+
| **Frontmatter** | All pages have `title`, and key pages have `description` |
|
|
57
|
+
| **Links** | Internal links point to existing pages |
|
|
58
|
+
| **Versions** | Content exists in all active version directories |
|
|
59
|
+
| **Sidebar Order** | `sidebar_position` values create a logical reading flow |
|
|
60
|
+
| **Categories** | Each folder has a `_category_.json` with `label` and `position` |
|
|
61
|
+
|
|
62
|
+
## Visual Testing
|
|
63
|
+
|
|
64
|
+
Preview the site locally and check:
|
|
65
|
+
|
|
66
|
+
<Steps>
|
|
67
|
+
<Step title="Start Dev Server">
|
|
68
|
+
Run `npm run dev` and open the site in your browser.
|
|
69
|
+
</Step>
|
|
70
|
+
|
|
71
|
+
<Step title="Check Navigation">
|
|
72
|
+
Verify sidebar links work, breadcrumbs are correct, and previous/next navigation follows the expected order.
|
|
73
|
+
</Step>
|
|
74
|
+
|
|
75
|
+
<Step title="Check Themes">
|
|
76
|
+
Toggle between light and dark themes. Ensure all content is readable in both modes.
|
|
77
|
+
</Step>
|
|
78
|
+
|
|
79
|
+
<Step title="Check Responsive">
|
|
80
|
+
Test on different viewport sizes. The mobile sidebar should collapse into a menu.
|
|
81
|
+
</Step>
|
|
82
|
+
</Steps>
|
|
83
|
+
|
|
84
|
+
## Common Issues
|
|
85
|
+
|
|
86
|
+
### Frontmatter Parsing Errors
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
Error: Invalid frontmatter in docs/v2.0.0/page.mdx
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Ensure your frontmatter uses valid YAML syntax and is enclosed by `---` delimiters.
|
|
93
|
+
|
|
94
|
+
### Missing Pages
|
|
95
|
+
|
|
96
|
+
If a page doesn't appear in the sidebar:
|
|
97
|
+
|
|
98
|
+
1. Check the file has the `.mdx` extension (not `.md`)
|
|
99
|
+
2. Verify the file is in the correct version directory
|
|
100
|
+
3. Check if `draft: true` is set in frontmatter
|
|
101
|
+
|
|
102
|
+
### Broken Links
|
|
103
|
+
|
|
104
|
+
If internal links return 404:
|
|
105
|
+
|
|
106
|
+
1. Check the path matches the file structure
|
|
107
|
+
2. Include the version prefix: `/docs/v2.0.0/page-name`
|
|
108
|
+
3. Use the file's slug (filename without `.mdx`), not the title
|
|
109
|
+
|
|
110
|
+
<Callout type="info">
|
|
111
|
+
The dev server shows detailed error messages in the browser overlay. Check the terminal output for build-time errors.
|
|
112
|
+
</Callout>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-docs",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "vite dev",
|
|
8
|
+
"build": "vite build",
|
|
9
|
+
"preview": "vite preview",
|
|
10
|
+
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"specra": "^0.2.4"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@sveltejs/adapter-static": "^3.0.0",
|
|
17
|
+
"@sveltejs/kit": "^2.0.0",
|
|
18
|
+
"@sveltejs/vite-plugin-svelte": "^6.0.0",
|
|
19
|
+
"@tailwindcss/postcss": "^4.1.9",
|
|
20
|
+
"@tailwindcss/typography": "^0.5.19",
|
|
21
|
+
"postcss": "^8.5",
|
|
22
|
+
"svelte": "^5.0.0",
|
|
23
|
+
"svelte-check": "^4.0.0",
|
|
24
|
+
"tailwindcss": "^4.1.9",
|
|
25
|
+
"typescript": "^5",
|
|
26
|
+
"vite": "^6.3.0"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.0",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "User Management API",
|
|
5
|
+
"version": "1.0.0",
|
|
6
|
+
"description": "A simple API for managing users (OpenAPI format example)"
|
|
7
|
+
},
|
|
8
|
+
"servers": [
|
|
9
|
+
{
|
|
10
|
+
"url": "https://api.example.com/v1",
|
|
11
|
+
"description": "Production server"
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"components": {
|
|
15
|
+
"securitySchemes": {
|
|
16
|
+
"bearerAuth": {
|
|
17
|
+
"type": "http",
|
|
18
|
+
"scheme": "bearer",
|
|
19
|
+
"description": "JWT Bearer token authentication"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"schemas": {
|
|
23
|
+
"User": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"id": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"example": "user_123"
|
|
29
|
+
},
|
|
30
|
+
"name": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"example": "John Doe"
|
|
33
|
+
},
|
|
34
|
+
"email": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "email",
|
|
37
|
+
"example": "john@example.com"
|
|
38
|
+
},
|
|
39
|
+
"createdAt": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"format": "date-time",
|
|
42
|
+
"example": "2024-01-15T10:30:00Z"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"Error": {
|
|
47
|
+
"type": "object",
|
|
48
|
+
"properties": {
|
|
49
|
+
"error": {
|
|
50
|
+
"type": "string"
|
|
51
|
+
},
|
|
52
|
+
"code": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"security": [
|
|
60
|
+
{
|
|
61
|
+
"bearerAuth": []
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"paths": {
|
|
65
|
+
"/users": {
|
|
66
|
+
"get": {
|
|
67
|
+
"summary": "List all users",
|
|
68
|
+
"description": "Retrieve a paginated list of all users",
|
|
69
|
+
"operationId": "listUsers",
|
|
70
|
+
"parameters": [
|
|
71
|
+
{
|
|
72
|
+
"name": "page",
|
|
73
|
+
"in": "query",
|
|
74
|
+
"description": "Page number for pagination",
|
|
75
|
+
"schema": {
|
|
76
|
+
"type": "integer",
|
|
77
|
+
"default": 1,
|
|
78
|
+
"example": 1
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "limit",
|
|
83
|
+
"in": "query",
|
|
84
|
+
"description": "Number of items per page",
|
|
85
|
+
"schema": {
|
|
86
|
+
"type": "integer",
|
|
87
|
+
"default": 10,
|
|
88
|
+
"example": 10
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
],
|
|
92
|
+
"responses": {
|
|
93
|
+
"200": {
|
|
94
|
+
"description": "List of users retrieved successfully",
|
|
95
|
+
"content": {
|
|
96
|
+
"application/json": {
|
|
97
|
+
"schema": {
|
|
98
|
+
"type": "array",
|
|
99
|
+
"items": {
|
|
100
|
+
"$ref": "#/components/schemas/User"
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"example": [
|
|
104
|
+
{
|
|
105
|
+
"id": "user_123",
|
|
106
|
+
"name": "John Doe",
|
|
107
|
+
"email": "john@example.com",
|
|
108
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
"id": "user_456",
|
|
112
|
+
"name": "Jane Smith",
|
|
113
|
+
"email": "jane@example.com",
|
|
114
|
+
"createdAt": "2024-01-16T14:20:00Z"
|
|
115
|
+
}
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"post": {
|
|
123
|
+
"summary": "Create a new user",
|
|
124
|
+
"description": "Create a new user account",
|
|
125
|
+
"operationId": "createUser",
|
|
126
|
+
"requestBody": {
|
|
127
|
+
"description": "User data to create",
|
|
128
|
+
"required": true,
|
|
129
|
+
"content": {
|
|
130
|
+
"application/json": {
|
|
131
|
+
"schema": {
|
|
132
|
+
"type": "object",
|
|
133
|
+
"required": ["name", "email"],
|
|
134
|
+
"properties": {
|
|
135
|
+
"name": {
|
|
136
|
+
"type": "string",
|
|
137
|
+
"example": "John Doe"
|
|
138
|
+
},
|
|
139
|
+
"email": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"format": "email",
|
|
142
|
+
"example": "john@example.com"
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"responses": {
|
|
150
|
+
"201": {
|
|
151
|
+
"description": "User created successfully",
|
|
152
|
+
"content": {
|
|
153
|
+
"application/json": {
|
|
154
|
+
"schema": {
|
|
155
|
+
"$ref": "#/components/schemas/User"
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
"400": {
|
|
161
|
+
"description": "Invalid request data",
|
|
162
|
+
"content": {
|
|
163
|
+
"application/json": {
|
|
164
|
+
"schema": {
|
|
165
|
+
"$ref": "#/components/schemas/Error"
|
|
166
|
+
},
|
|
167
|
+
"example": {
|
|
168
|
+
"error": "Email already exists",
|
|
169
|
+
"code": "DUPLICATE_EMAIL"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"/users/{id}": {
|
|
178
|
+
"get": {
|
|
179
|
+
"summary": "Get user by ID",
|
|
180
|
+
"description": "Retrieve a single user by their unique identifier",
|
|
181
|
+
"operationId": "getUserById",
|
|
182
|
+
"parameters": [
|
|
183
|
+
{
|
|
184
|
+
"name": "id",
|
|
185
|
+
"in": "path",
|
|
186
|
+
"required": true,
|
|
187
|
+
"description": "The user's unique identifier",
|
|
188
|
+
"schema": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"example": "user_123"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"responses": {
|
|
195
|
+
"200": {
|
|
196
|
+
"description": "User retrieved successfully",
|
|
197
|
+
"content": {
|
|
198
|
+
"application/json": {
|
|
199
|
+
"schema": {
|
|
200
|
+
"$ref": "#/components/schemas/User"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
"404": {
|
|
206
|
+
"description": "User not found",
|
|
207
|
+
"content": {
|
|
208
|
+
"application/json": {
|
|
209
|
+
"schema": {
|
|
210
|
+
"$ref": "#/components/schemas/Error"
|
|
211
|
+
},
|
|
212
|
+
"example": {
|
|
213
|
+
"error": "User not found",
|
|
214
|
+
"code": "USER_NOT_FOUND"
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"delete": {
|
|
222
|
+
"summary": "Delete a user",
|
|
223
|
+
"description": "Permanently delete a user account",
|
|
224
|
+
"operationId": "deleteUser",
|
|
225
|
+
"parameters": [
|
|
226
|
+
{
|
|
227
|
+
"name": "id",
|
|
228
|
+
"in": "path",
|
|
229
|
+
"required": true,
|
|
230
|
+
"description": "The user's unique identifier",
|
|
231
|
+
"schema": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"example": "user_123"
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
],
|
|
237
|
+
"responses": {
|
|
238
|
+
"204": {
|
|
239
|
+
"description": "User deleted successfully"
|
|
240
|
+
},
|
|
241
|
+
"404": {
|
|
242
|
+
"description": "User not found",
|
|
243
|
+
"content": {
|
|
244
|
+
"application/json": {
|
|
245
|
+
"schema": {
|
|
246
|
+
"$ref": "#/components/schemas/Error"
|
|
247
|
+
},
|
|
248
|
+
"example": {
|
|
249
|
+
"error": "User not found",
|
|
250
|
+
"code": "USER_NOT_FOUND"
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"name": "Product API",
|
|
4
|
+
"description": "API for managing products in an e-commerce system (Postman Collection example)",
|
|
5
|
+
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
6
|
+
"version": "1.0.0"
|
|
7
|
+
},
|
|
8
|
+
"auth": {
|
|
9
|
+
"type": "bearer"
|
|
10
|
+
},
|
|
11
|
+
"variable": [
|
|
12
|
+
{
|
|
13
|
+
"key": "baseUrl",
|
|
14
|
+
"value": "https://api.store.com/v1",
|
|
15
|
+
"type": "string"
|
|
16
|
+
}
|
|
17
|
+
],
|
|
18
|
+
"item": [
|
|
19
|
+
{
|
|
20
|
+
"name": "Products",
|
|
21
|
+
"item": [
|
|
22
|
+
{
|
|
23
|
+
"name": "Get All Products",
|
|
24
|
+
"request": {
|
|
25
|
+
"method": "GET",
|
|
26
|
+
"header": [
|
|
27
|
+
{
|
|
28
|
+
"key": "Accept",
|
|
29
|
+
"value": "application/json"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"url": {
|
|
33
|
+
"raw": "{{baseUrl}}/products?category=electronics&limit=10",
|
|
34
|
+
"host": ["{{baseUrl}}"],
|
|
35
|
+
"path": ["products"],
|
|
36
|
+
"query": [
|
|
37
|
+
{
|
|
38
|
+
"key": "category",
|
|
39
|
+
"value": "electronics",
|
|
40
|
+
"description": "Filter by product category"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"key": "limit",
|
|
44
|
+
"value": "10",
|
|
45
|
+
"description": "Maximum number of products to return"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"description": "Retrieve a list of products with optional filtering"
|
|
50
|
+
},
|
|
51
|
+
"response": [
|
|
52
|
+
{
|
|
53
|
+
"name": "Success Response",
|
|
54
|
+
"code": 200,
|
|
55
|
+
"body": "[\n {\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"category\": \"electronics\",\n \"inStock\": true\n },\n {\n \"id\": \"prod_456\",\n \"name\": \"Mouse\",\n \"price\": 29.99,\n \"category\": \"electronics\",\n \"inStock\": true\n }\n]"
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "Get Product by ID",
|
|
61
|
+
"request": {
|
|
62
|
+
"method": "GET",
|
|
63
|
+
"header": [
|
|
64
|
+
{
|
|
65
|
+
"key": "Accept",
|
|
66
|
+
"value": "application/json"
|
|
67
|
+
}
|
|
68
|
+
],
|
|
69
|
+
"url": {
|
|
70
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
71
|
+
"host": ["{{baseUrl}}"],
|
|
72
|
+
"path": ["products", ":id"],
|
|
73
|
+
"variable": [
|
|
74
|
+
{
|
|
75
|
+
"key": "id",
|
|
76
|
+
"value": "prod_123",
|
|
77
|
+
"description": "Product ID"
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"description": "Get a single product by its ID"
|
|
82
|
+
},
|
|
83
|
+
"response": [
|
|
84
|
+
{
|
|
85
|
+
"name": "Success",
|
|
86
|
+
"code": 200,
|
|
87
|
+
"body": "{\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 999.99,\n \"category\": \"electronics\",\n \"description\": \"High-performance laptop\",\n \"inStock\": true\n}"
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
"name": "Not Found",
|
|
91
|
+
"code": 404,
|
|
92
|
+
"body": "{\n \"error\": \"Product not found\",\n \"code\": \"PRODUCT_NOT_FOUND\"\n}"
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "Create Product",
|
|
98
|
+
"request": {
|
|
99
|
+
"method": "POST",
|
|
100
|
+
"header": [
|
|
101
|
+
{
|
|
102
|
+
"key": "Content-Type",
|
|
103
|
+
"value": "application/json"
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"key": "Accept",
|
|
107
|
+
"value": "application/json"
|
|
108
|
+
}
|
|
109
|
+
],
|
|
110
|
+
"body": {
|
|
111
|
+
"mode": "raw",
|
|
112
|
+
"raw": "{\n \"name\": \"Wireless Keyboard\",\n \"price\": 79.99,\n \"category\": \"electronics\",\n \"description\": \"Ergonomic wireless keyboard\",\n \"inStock\": true\n}"
|
|
113
|
+
},
|
|
114
|
+
"url": {
|
|
115
|
+
"raw": "{{baseUrl}}/products",
|
|
116
|
+
"host": ["{{baseUrl}}"],
|
|
117
|
+
"path": ["products"]
|
|
118
|
+
},
|
|
119
|
+
"description": "Create a new product in the catalog"
|
|
120
|
+
},
|
|
121
|
+
"response": [
|
|
122
|
+
{
|
|
123
|
+
"name": "Created",
|
|
124
|
+
"code": 201,
|
|
125
|
+
"body": "{\n \"id\": \"prod_789\",\n \"name\": \"Wireless Keyboard\",\n \"price\": 79.99,\n \"category\": \"electronics\",\n \"description\": \"Ergonomic wireless keyboard\",\n \"inStock\": true,\n \"createdAt\": \"2024-01-15T10:30:00Z\"\n}"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
"name": "Validation Error",
|
|
129
|
+
"code": 400,
|
|
130
|
+
"body": "{\n \"error\": \"Invalid product data\",\n \"details\": {\n \"price\": \"Price must be a positive number\"\n }\n}"
|
|
131
|
+
}
|
|
132
|
+
]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"name": "Update Product",
|
|
136
|
+
"request": {
|
|
137
|
+
"method": "PATCH",
|
|
138
|
+
"header": [
|
|
139
|
+
{
|
|
140
|
+
"key": "Content-Type",
|
|
141
|
+
"value": "application/json"
|
|
142
|
+
}
|
|
143
|
+
],
|
|
144
|
+
"body": {
|
|
145
|
+
"mode": "raw",
|
|
146
|
+
"raw": "{\n \"price\": 89.99,\n \"inStock\": false\n}"
|
|
147
|
+
},
|
|
148
|
+
"url": {
|
|
149
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
150
|
+
"host": ["{{baseUrl}}"],
|
|
151
|
+
"path": ["products", ":id"],
|
|
152
|
+
"variable": [
|
|
153
|
+
{
|
|
154
|
+
"key": "id",
|
|
155
|
+
"value": "prod_123",
|
|
156
|
+
"description": "Product ID to update"
|
|
157
|
+
}
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"description": "Update specific fields of a product"
|
|
161
|
+
},
|
|
162
|
+
"response": [
|
|
163
|
+
{
|
|
164
|
+
"name": "Updated",
|
|
165
|
+
"code": 200,
|
|
166
|
+
"body": "{\n \"id\": \"prod_123\",\n \"name\": \"Laptop\",\n \"price\": 89.99,\n \"category\": \"electronics\",\n \"description\": \"High-performance laptop\",\n \"inStock\": false,\n \"updatedAt\": \"2024-01-16T15:45:00Z\"\n}"
|
|
167
|
+
}
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
"name": "Delete Product",
|
|
172
|
+
"request": {
|
|
173
|
+
"method": "DELETE",
|
|
174
|
+
"header": [],
|
|
175
|
+
"url": {
|
|
176
|
+
"raw": "{{baseUrl}}/products/:id",
|
|
177
|
+
"host": ["{{baseUrl}}"],
|
|
178
|
+
"path": ["products", ":id"],
|
|
179
|
+
"variable": [
|
|
180
|
+
{
|
|
181
|
+
"key": "id",
|
|
182
|
+
"value": "prod_123",
|
|
183
|
+
"description": "Product ID to delete"
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
},
|
|
187
|
+
"description": "Delete a product from the catalog"
|
|
188
|
+
},
|
|
189
|
+
"response": [
|
|
190
|
+
{
|
|
191
|
+
"name": "Deleted",
|
|
192
|
+
"code": 204,
|
|
193
|
+
"body": ""
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"name": "Not Found",
|
|
197
|
+
"code": 404,
|
|
198
|
+
"body": "{\n \"error\": \"Product not found\"\n}"
|
|
199
|
+
}
|
|
200
|
+
]
|
|
201
|
+
}
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
]
|
|
205
|
+
}
|