directus-extension-api-docs 1.2.1 → 1.2.3

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 +20 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -22,7 +22,7 @@ Ref: https://github.com/directus/directus
22
22
 
23
23
  For include you custom endpoints.
24
24
 
25
- Create a `oas.json` file under `/extensions/endpoints` folder.
25
+ Create a `oasconfig.json` file under `/extensions/endpoints` folder.
26
26
 
27
27
  Example below:
28
28
 
@@ -40,17 +40,19 @@ Example below:
40
40
  "post": {
41
41
  "summary": "do something",
42
42
  "description": "do something",
43
- "parameters": [
44
- {
45
- "$ref": "#/components/parameters/Meta"
46
- }
47
- ],
48
43
  "requestBody": {
49
44
  "content": {
50
45
  "application/json": {
51
46
  "schema": {
52
- "$ref": "#/components/schemas/Users"
53
- }
47
+ "type": "object",
48
+ "required": [
49
+ "field"
50
+ ],
51
+ "properties": {
52
+ "field": {
53
+ "type": "string"
54
+ }
55
+ }
54
56
  }
55
57
  }
56
58
  },
@@ -62,8 +64,8 @@ Example below:
62
64
  "schema": {
63
65
  "type": "object",
64
66
  "properties": {
65
- "data": {
66
- "$ref": "#/components/schemas/Users"
67
+ "field": {
68
+ "type": "string"
67
69
  }
68
70
  }
69
71
  }
@@ -71,10 +73,12 @@ Example below:
71
73
  }
72
74
  },
73
75
  "401": {
74
- "$ref": "#/components/responses/UnauthorizedError"
76
+ "description": "Unauthorized",
77
+ "content": {}
75
78
  },
76
79
  "404": {
77
- "$ref": "#/components/responses/NotFoundError"
80
+ "description": "Not Found",
81
+ "content": {}
78
82
  }
79
83
  },
80
84
  "tags": [
@@ -105,6 +109,10 @@ module.exports = {
105
109
  id,
106
110
  handler: function registerEndpoint(router, { services, exceptions, logger }) {
107
111
 
112
+ router.post('/my-endpoint-not-validated', async (req, res, next) => {
113
+ ...
114
+ });
115
+
108
116
  validate(router, [`/${id}/my-endpoint`]);
109
117
 
110
118
  router.post('/my-endpoint', async (req, res, next) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "directus-extension-api-docs",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
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",