directus-extension-api-docs 1.0.6 → 1.0.8

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 (2) hide show
  1. package/README.md +77 -1
  2. package/package.json +6 -6
package/README.md CHANGED
@@ -1,2 +1,78 @@
1
1
  # directus-extension-api-docs
2
- directus extension for swagger interface and custom endpoints definitions
2
+
3
+ Directus Extension to include a Swagger interface and custom endpoints definitions
4
+
5
+ ![workspace](assets/swagger.png)
6
+
7
+ All directus endpoints are autogenerated on runtime.
8
+
9
+ ## Prerequisites
10
+
11
+ Working in a Directus nodejs project
12
+
13
+ Ref: https://github.com/directus/directus
14
+
15
+ ## Installation
16
+
17
+ npm install directus-extension-api-docs
18
+
19
+ ## Configuration
20
+
21
+ For include you custom endpoints.
22
+
23
+ Create a `oas.json` file under `/extensions/endpoints` folder.
24
+ Example below:
25
+
26
+ ```
27
+ {
28
+ "paths": {
29
+ "/my-custom-path/my-endpoint": {
30
+ "post": {
31
+ "summary": "do something",
32
+ "description": "do something",
33
+ "parameters": [
34
+ {
35
+ "$ref": "#/components/parameters/Meta"
36
+ }
37
+ ],
38
+ "requestBody": {
39
+ "content": {
40
+ "application/json": {
41
+ "schema": {
42
+ "$ref": "#/components/schemas/Users"
43
+ }
44
+ }
45
+ }
46
+ },
47
+ "responses": {
48
+ "200": {
49
+ "description": "Successful request",
50
+ "content": {
51
+ "application/json": {
52
+ "schema": {
53
+ "type": "object",
54
+ "properties": {
55
+ "data": {
56
+ "$ref": "#/components/schemas/Users"
57
+ }
58
+ }
59
+ }
60
+ }
61
+ }
62
+ },
63
+ "401": {
64
+ "$ref": "#/components/responses/UnauthorizedError"
65
+ },
66
+ "404": {
67
+ "$ref": "#/components/responses/NotFoundError"
68
+ }
69
+ },
70
+ "tags": [
71
+ "MyCustomTag",
72
+ "Assets"
73
+ ]
74
+ }
75
+ }
76
+ }
77
+ }
78
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-extension-api-docs",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "directus extension for swagger interface and custom endpoints definitions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -38,15 +38,14 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@babel/preset-env": "^7.20.2",
41
- "@typescript-eslint/eslint-plugin": "^5.42.1",
42
- "@typescript-eslint/parser": "^5.42.1",
43
- "babel-jest": "^29.3.1",
44
41
  "@directus/extensions-sdk": "9.19.2",
45
42
  "@types/jest": "^29.2.2",
46
43
  "@types/node": "^18.11.9",
44
+ "@typescript-eslint/eslint-plugin": "^5.42.1",
45
+ "@typescript-eslint/parser": "^5.42.1",
46
+ "babel-jest": "^29.3.1",
47
47
  "eslint": "^8.27.0",
48
48
  "eslint-config-prettier": "^8.5.0",
49
- "typescript": "^4.8.4",
50
49
  "eslint-plugin-import": "^2.26.0",
51
50
  "eslint-plugin-prettier": "^4.2.1",
52
51
  "jest": "^29.3.1",
@@ -54,6 +53,7 @@
54
53
  "openapi-schema-validator": "^12.0.2",
55
54
  "prettier": "^2.7.1",
56
55
  "ts-jest": "^29.0.3",
57
- "ts-node": "^10.9.1"
56
+ "ts-node": "^10.9.1",
57
+ "typescript": "^4.8.4"
58
58
  }
59
59
  }