@strapi/plugin-documentation 4.10.0-beta.0 → 4.10.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/.eslintignore +2 -0
- package/.eslintrc.js +14 -0
- package/admin/src/pages/PluginPage/index.js +3 -3
- package/admin/src/pages/utils/useReactQuery.js +34 -14
- package/jest.config.front.js +5 -0
- package/jest.config.js +5 -0
- package/package.json +11 -8
- package/server/config/default-plugin-config.js +2 -41
- package/server/services/__mocks__/mock-content-types.js +269 -0
- package/server/services/__mocks__/mock-strapi-data.js +183 -0
- package/server/services/__tests__/build-component-schema.test.js +761 -0
- package/server/services/__tests__/documentation.test.js +481 -0
- package/server/services/__tests__/override.test.js +85 -0
- package/server/services/documentation.js +123 -84
- package/server/services/helpers/build-api-endpoint-path.js +3 -2
- package/server/services/helpers/build-component-schema.js +108 -70
- package/server/services/helpers/utils/clean-schema-attributes.js +15 -7
- package/server/services/helpers/utils/loop-content-type-names.js +3 -1
- package/server/services/index.js +2 -0
- package/server/services/override.js +52 -0
- package/server/services/utils/default-openapi-components.js +40 -0
- package/server/services/utils/get-plugins-that-need-documentation.js +24 -0
- package/__mocks__/strapi.js +0 -41
- package/__tests__/build-component-schema.test.js +0 -271
- package/admin/src/pages/utils/api.js +0 -31
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const contentTypes = require('./mock-content-types');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
contentTypes,
|
|
7
|
+
components: {
|
|
8
|
+
'basic.simple': {
|
|
9
|
+
collectionName: 'components_basic_simples',
|
|
10
|
+
info: { displayName: 'simple', icon: 'ambulance', description: '' },
|
|
11
|
+
options: {},
|
|
12
|
+
attributes: { name: { type: 'string', required: true }, test: { type: 'string' } },
|
|
13
|
+
uid: 'basic.simple',
|
|
14
|
+
category: 'basic',
|
|
15
|
+
modelType: 'component',
|
|
16
|
+
modelName: 'simple',
|
|
17
|
+
globalId: 'ComponentBasicSimple',
|
|
18
|
+
},
|
|
19
|
+
'blog.test-como': {
|
|
20
|
+
collectionName: 'components_blog_test_comos',
|
|
21
|
+
info: { displayName: 'test comp', icon: 'air-freshener', description: '' },
|
|
22
|
+
options: {},
|
|
23
|
+
attributes: { name: { type: 'string', default: 'toto' } },
|
|
24
|
+
uid: 'blog.test-como',
|
|
25
|
+
category: 'blog',
|
|
26
|
+
modelType: 'component',
|
|
27
|
+
modelName: 'test-como',
|
|
28
|
+
globalId: 'ComponentBlogTestComo',
|
|
29
|
+
},
|
|
30
|
+
'basic.relation': {
|
|
31
|
+
collectionName: 'components_basic_relations',
|
|
32
|
+
info: { displayName: 'Relation' },
|
|
33
|
+
options: {},
|
|
34
|
+
attributes: {
|
|
35
|
+
categories: { type: 'relation', relation: 'oneToMany', target: 'api::category.category' },
|
|
36
|
+
},
|
|
37
|
+
uid: 'basic.relation',
|
|
38
|
+
category: 'basic',
|
|
39
|
+
modelType: 'component',
|
|
40
|
+
modelName: 'relation',
|
|
41
|
+
globalId: 'ComponentBasicRelation',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
plugins: {
|
|
45
|
+
upload: {
|
|
46
|
+
contentTypes: {
|
|
47
|
+
file: contentTypes['plugin::upload.file'],
|
|
48
|
+
folder: contentTypes['plugin::upload.folder'],
|
|
49
|
+
},
|
|
50
|
+
routes: {
|
|
51
|
+
'content-api': {
|
|
52
|
+
type: 'content-api',
|
|
53
|
+
routes: [
|
|
54
|
+
{
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: '/',
|
|
57
|
+
handler: 'content-api.upload',
|
|
58
|
+
config: { auth: { scope: ['plugin::upload.content-api.upload'] } },
|
|
59
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
method: 'GET',
|
|
63
|
+
path: '/files',
|
|
64
|
+
handler: 'content-api.find',
|
|
65
|
+
config: { auth: { scope: ['plugin::upload.content-api.find'] } },
|
|
66
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
method: 'GET',
|
|
70
|
+
path: '/files/:id',
|
|
71
|
+
handler: 'content-api.findOne',
|
|
72
|
+
config: { auth: { scope: ['plugin::upload.content-api.findOne'] } },
|
|
73
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
method: 'DELETE',
|
|
77
|
+
path: '/files/:id',
|
|
78
|
+
handler: 'content-api.destroy',
|
|
79
|
+
config: { auth: { scope: ['plugin::upload.content-api.destroy'] } },
|
|
80
|
+
info: { pluginName: 'upload', type: 'content-api' },
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
prefix: '/upload',
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
email: {
|
|
88
|
+
contentTypes: {},
|
|
89
|
+
},
|
|
90
|
+
'users-permissions': {
|
|
91
|
+
contentTypes: {},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
api: {
|
|
95
|
+
homepage: {
|
|
96
|
+
contentTypes: {
|
|
97
|
+
homepage: contentTypes['api::homepage.homepage'],
|
|
98
|
+
},
|
|
99
|
+
routes: {
|
|
100
|
+
homepage: {
|
|
101
|
+
type: 'content-api',
|
|
102
|
+
routes: [
|
|
103
|
+
{
|
|
104
|
+
method: 'GET',
|
|
105
|
+
path: '/homepage',
|
|
106
|
+
handler: 'api::homepage.homepage.find',
|
|
107
|
+
config: { auth: { scope: ['api::homepage.homepage.find'] } },
|
|
108
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
method: 'PUT',
|
|
112
|
+
path: '/homepage',
|
|
113
|
+
handler: 'api::homepage.homepage.update',
|
|
114
|
+
config: { auth: { scope: ['api::homepage.homepage.update'] } },
|
|
115
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
method: 'DELETE',
|
|
119
|
+
path: '/homepage',
|
|
120
|
+
handler: 'api::homepage.homepage.delete',
|
|
121
|
+
config: { auth: { scope: ['api::homepage.homepage.delete'] } },
|
|
122
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
method: 'POST',
|
|
126
|
+
path: '/homepage',
|
|
127
|
+
handler: 'api::homepage.homepage.create',
|
|
128
|
+
config: { auth: { scope: ['api::homepage.homepage.create'] } },
|
|
129
|
+
info: { apiName: 'homepage', type: 'content-api' },
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
kitchensink: {
|
|
136
|
+
contentTypes: {
|
|
137
|
+
kitchensink: contentTypes['api::kitchensink.kitchensink'],
|
|
138
|
+
},
|
|
139
|
+
routes: {
|
|
140
|
+
kitchensink: {
|
|
141
|
+
routes: [
|
|
142
|
+
{
|
|
143
|
+
method: 'GET',
|
|
144
|
+
path: '/kitchensinks',
|
|
145
|
+
handler: 'api::kitchensink.kitchensink.find',
|
|
146
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.find'] } },
|
|
147
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
method: 'GET',
|
|
151
|
+
path: '/kitchensinks/:id',
|
|
152
|
+
handler: 'api::kitchensink.kitchensink.findOne',
|
|
153
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.findOne'] } },
|
|
154
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
method: 'POST',
|
|
158
|
+
path: '/kitchensinks',
|
|
159
|
+
handler: 'api::kitchensink.kitchensink.create',
|
|
160
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.create'] } },
|
|
161
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
method: 'PUT',
|
|
165
|
+
path: '/kitchensinks/:id',
|
|
166
|
+
handler: 'api::kitchensink.kitchensink.update',
|
|
167
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.update'] } },
|
|
168
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
method: 'DELETE',
|
|
172
|
+
path: '/kitchensinks/:id',
|
|
173
|
+
handler: 'api::kitchensink.kitchensink.delete',
|
|
174
|
+
config: { auth: { scope: ['api::kitchensink.kitchensink.delete'] } },
|
|
175
|
+
info: { apiName: 'kitchensink', type: 'content-api' },
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
type: 'content-api',
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
};
|