@strapi/plugin-documentation 4.0.0-next.9 → 4.0.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 (71) hide show
  1. package/admin/src/components/FieldActionWrapper/index.js +14 -0
  2. package/admin/src/components/PluginIcon/index.js +12 -0
  3. package/admin/src/index.js +23 -11
  4. package/admin/src/pages/PluginPage/index.js +199 -0
  5. package/admin/src/pages/PluginPage/tests/index.test.js +873 -0
  6. package/admin/src/pages/PluginPage/tests/server.js +23 -0
  7. package/admin/src/pages/SettingsPage/index.js +181 -0
  8. package/admin/src/pages/SettingsPage/tests/index.test.js +612 -0
  9. package/admin/src/pages/SettingsPage/tests/server.js +18 -0
  10. package/admin/src/pages/{HomePage/utils → utils}/api.js +5 -4
  11. package/admin/src/pages/{HomePage/utils → utils}/schema.js +0 -0
  12. package/admin/src/pages/utils/useReactQuery.js +46 -0
  13. package/admin/src/translations/ar.json +0 -3
  14. package/admin/src/translations/cs.json +0 -3
  15. package/admin/src/translations/de.json +0 -3
  16. package/admin/src/translations/en.json +14 -3
  17. package/admin/src/translations/es.json +0 -3
  18. package/admin/src/translations/fr.json +0 -3
  19. package/admin/src/translations/id.json +0 -3
  20. package/admin/src/translations/it.json +0 -3
  21. package/admin/src/translations/ko.json +41 -22
  22. package/admin/src/translations/ms.json +0 -3
  23. package/admin/src/translations/nl.json +0 -3
  24. package/admin/src/translations/pl.json +0 -3
  25. package/admin/src/translations/pt-BR.json +0 -3
  26. package/admin/src/translations/pt.json +0 -3
  27. package/admin/src/translations/ru.json +0 -3
  28. package/admin/src/translations/sk.json +0 -3
  29. package/admin/src/translations/th.json +0 -3
  30. package/admin/src/translations/tr.json +0 -3
  31. package/admin/src/translations/uk.json +0 -3
  32. package/admin/src/translations/vi.json +0 -3
  33. package/admin/src/translations/zh-Hans.json +3 -6
  34. package/admin/src/translations/zh.json +0 -3
  35. package/package.json +33 -48
  36. package/server/bootstrap.js +19 -105
  37. package/server/config/default-config.js +12 -15
  38. package/server/config/index.js +10 -2
  39. package/server/controllers/documentation.js +61 -127
  40. package/server/index.js +17 -0
  41. package/server/middlewares/documentation.js +18 -41
  42. package/server/{policies/index-policy.js → middlewares/restrict-access.js} +5 -16
  43. package/{public → server/public}/index.html +0 -0
  44. package/{public → server/public}/login.html +0 -0
  45. package/server/register.js +11 -0
  46. package/server/routes/index.js +18 -25
  47. package/server/services/documentation.js +125 -1835
  48. package/server/utils/builders/build-api-endpoint-path.js +174 -0
  49. package/server/utils/builders/build-api-requests.js +41 -0
  50. package/server/utils/builders/build-api-responses.js +108 -0
  51. package/server/utils/builders/index.js +11 -0
  52. package/server/utils/clean-schema-attributes.js +205 -0
  53. package/server/utils/error-response.js +22 -0
  54. package/server/utils/get-schema-data.js +32 -0
  55. package/server/utils/query-params.js +84 -0
  56. package/strapi-admin.js +3 -0
  57. package/strapi-server.js +1 -19
  58. package/admin/src/assets/images/logo.svg +0 -1
  59. package/admin/src/components/Block/components.js +0 -26
  60. package/admin/src/components/Block/index.js +0 -39
  61. package/admin/src/components/Copy/index.js +0 -36
  62. package/admin/src/components/Header/index.js +0 -72
  63. package/admin/src/components/Row/ButtonContainer.js +0 -67
  64. package/admin/src/components/Row/components.js +0 -83
  65. package/admin/src/components/Row/index.js +0 -51
  66. package/admin/src/pages/App/index.js +0 -21
  67. package/admin/src/pages/HomePage/components.js +0 -59
  68. package/admin/src/pages/HomePage/index.js +0 -175
  69. package/admin/src/pages/HomePage/useHomePage.js +0 -56
  70. package/server/policies/index.js +0 -7
  71. package/server/services/utils/forms.json +0 -29
@@ -0,0 +1,174 @@
1
+ 'use strict';
2
+
3
+ const _ = require('lodash');
4
+ const pathToRegexp = require('path-to-regexp');
5
+
6
+ const queryParams = require('../query-params');
7
+ const buildApiRequests = require('./build-api-requests');
8
+ const buildApiResponses = require('./build-api-responses');
9
+
10
+ /**
11
+ * @description Parses a route with ':variable'
12
+ *
13
+ * @param {string} routePath - The route's path property
14
+ * @returns {string}
15
+ */
16
+ const parsePathWithVariables = routePath => {
17
+ return pathToRegexp
18
+ .parse(routePath)
19
+ .map(token => {
20
+ if (_.isObject(token)) {
21
+ return token.prefix + '{' + token.name + '}';
22
+ }
23
+
24
+ return token;
25
+ })
26
+ .join('');
27
+ };
28
+
29
+ /**
30
+ * @description Builds the required object for a path parameter
31
+ *
32
+ * @param {string} routePath - The route's path property
33
+ *
34
+ * @returns {object } Swagger path params object
35
+ */
36
+ const getPathParams = routePath => {
37
+ return pathToRegexp
38
+ .parse(routePath)
39
+ .filter(token => _.isObject(token))
40
+ .map(param => {
41
+ return {
42
+ name: param.name,
43
+ in: 'path',
44
+ description: '',
45
+ deprecated: false,
46
+ required: true,
47
+ schema: { type: 'string' },
48
+ };
49
+ });
50
+ };
51
+
52
+ /**
53
+ *
54
+ * @param {string} prefix - The route prefix
55
+ * @param {string} path - The route path
56
+ *
57
+ * @returns {string}
58
+ */
59
+ const getPathWithPrefix = (prefix, path) => {
60
+ if (path.includes('localizations')) {
61
+ return path;
62
+ }
63
+
64
+ if (path.endsWith('/')) {
65
+ return prefix;
66
+ }
67
+
68
+ return prefix.concat(path);
69
+ };
70
+
71
+ /**
72
+ *
73
+ * @param {object} api - Information about the api
74
+ * @param {object} api.routeInfo - The routes for a given api or plugin
75
+ * @param {string} api.routeInfo.prefix - The prefix for all routes
76
+ * @param {array} api.routeInfo.routes - The routes for the current api
77
+ * @param {object} api.attributes - The attributes for a given api or plugin
78
+ * @param {string} api.tag - A descriptor for OpenAPI
79
+ *
80
+ * @returns {object}
81
+ */
82
+ const getPaths = ({ routeInfo, attributes, tag }) => {
83
+ const paths = routeInfo.routes.reduce((acc, route) => {
84
+ // TODO: Find a more reliable way to determine list of entities vs a single entity
85
+ const isListOfEntities = route.handler.split('.').pop() === 'find';
86
+ const methodVerb = route.method.toLowerCase();
87
+
88
+ const hasPathParams = route.path.includes('/:');
89
+ const pathWithPrefix = routeInfo.prefix
90
+ ? getPathWithPrefix(routeInfo.prefix, route.path)
91
+ : route.path;
92
+ const routePath = hasPathParams ? parsePathWithVariables(pathWithPrefix) : pathWithPrefix;
93
+
94
+ const { responses } = buildApiResponses(attributes, route, isListOfEntities);
95
+
96
+ const swaggerConfig = {
97
+ responses,
98
+ tags: [_.upperFirst(tag)],
99
+ parameters: [],
100
+ requestBody: {},
101
+ };
102
+
103
+ if (isListOfEntities) {
104
+ swaggerConfig.parameters.push(...queryParams);
105
+ }
106
+
107
+ if (hasPathParams) {
108
+ const pathParams = getPathParams(route.path);
109
+ swaggerConfig.parameters.push(...pathParams);
110
+ }
111
+
112
+ if (['post', 'put'].includes(methodVerb)) {
113
+ const { requestBody } = buildApiRequests(attributes, route);
114
+
115
+ swaggerConfig.requestBody = requestBody;
116
+ }
117
+
118
+ _.set(acc, `${routePath}.${methodVerb}`, swaggerConfig);
119
+
120
+ return acc;
121
+ }, {});
122
+
123
+ return { paths };
124
+ };
125
+
126
+ /**
127
+ * @description - Builds the Swagger paths object for each api
128
+ *
129
+ * @param {object} api - Information about the current api
130
+ * @property {string} api.name - The name of the api
131
+ * @property {string} api.getter - The getter for the api (api | plugin)
132
+ * @property {array} api.ctNames - The name of all contentTypes found on the api
133
+ *
134
+ * @returns {object}
135
+ */
136
+ module.exports = api => {
137
+ if (!api.ctNames.length && api.getter === 'plugin') {
138
+ // Set arbitrary attributes
139
+ const attributes = { foo: { type: 'string' } };
140
+ const routeInfo = strapi.plugin(api.name).routes['admin'];
141
+
142
+ const apiInfo = {
143
+ routeInfo,
144
+ attributes,
145
+ tag: api.name,
146
+ };
147
+
148
+ return getPaths(apiInfo);
149
+ }
150
+
151
+ // An api could have multiple contentTypes
152
+ for (const contentTypeName of api.ctNames) {
153
+ // Get the attributes found on the api's contentType
154
+ const uid = `${api.getter}::${api.name}.${contentTypeName}`;
155
+ const ct = strapi.contentType(uid);
156
+ const attributes = ct.attributes;
157
+
158
+ // Get the routes for the current api
159
+ const routeInfo =
160
+ api.getter === 'plugin'
161
+ ? strapi.plugin(api.name).routes['content-api']
162
+ : strapi.api[api.name].routes[contentTypeName];
163
+
164
+ // Parse an identifier for OpenAPI tag if the api name and contentType name don't match
165
+ const tag = api.name === contentTypeName ? api.name : `${api.name} - ${contentTypeName}`;
166
+ const apiInfo = {
167
+ routeInfo,
168
+ attributes,
169
+ tag,
170
+ };
171
+
172
+ return getPaths(apiInfo);
173
+ }
174
+ };
@@ -0,0 +1,41 @@
1
+ 'use strict';
2
+
3
+ const cleanSchemaAttributes = require('../clean-schema-attributes');
4
+
5
+ /**
6
+ *
7
+ * @param {object} attributes - The attributes found on a contentType
8
+ * @param {object} route - The current route
9
+ *
10
+ * @returns The Swagger requestBody
11
+ */
12
+ module.exports = (attributes, route) => {
13
+ const requiredAttributes = Object.entries(attributes)
14
+ .filter(([, attribute]) => attribute.required)
15
+ .map(([attributeName, attribute]) => {
16
+ return { [attributeName]: attribute };
17
+ });
18
+
19
+ const requestAttributes =
20
+ route.method === 'POST' && requiredAttributes.length
21
+ ? Object.assign({}, ...requiredAttributes)
22
+ : attributes;
23
+
24
+ return {
25
+ requestBody: {
26
+ required: true,
27
+ content: {
28
+ 'application/json': {
29
+ schema: {
30
+ properties: {
31
+ data: {
32
+ type: 'object',
33
+ properties: cleanSchemaAttributes(requestAttributes, { isRequest: true }),
34
+ },
35
+ },
36
+ },
37
+ },
38
+ },
39
+ },
40
+ };
41
+ };
@@ -0,0 +1,108 @@
1
+ 'use strict';
2
+
3
+ const getSchemaData = require('../get-schema-data');
4
+ const cleanSchemaAttributes = require('../clean-schema-attributes');
5
+ const errorResponse = require('../error-response');
6
+
7
+ /**
8
+ *
9
+ * @param {boolean} isSingleEntity - Checks for a single entity
10
+ * @returns {object} The correctly formatted meta object
11
+ */
12
+ const getMeta = isListOfEntities => {
13
+ if (isListOfEntities) {
14
+ return {
15
+ type: 'object',
16
+ properties: {
17
+ pagination: {
18
+ properties: {
19
+ page: { type: 'integer' },
20
+ pageSize: { type: 'integer', minimum: 25 },
21
+ pageCount: { type: 'integer', maximum: 1 },
22
+ total: { type: 'integer' },
23
+ },
24
+ },
25
+ },
26
+ };
27
+ }
28
+
29
+ return { type: 'object' };
30
+ };
31
+
32
+ /**
33
+ * @description - Builds the Swagger response object for a given api
34
+ *
35
+ * @param {object} attributes - The attributes found on a contentType
36
+ * @param {object} route - The current route
37
+ * @param {boolean} isListOfEntities - Checks for a list of entitities
38
+ *
39
+ * @returns The Swagger responses
40
+ */
41
+ module.exports = (attributes, route, isListOfEntities = false) => {
42
+ let schema;
43
+ if (route.method === 'DELETE') {
44
+ schema = {
45
+ type: 'integer',
46
+ format: 'int64',
47
+ };
48
+ } else {
49
+ schema = {
50
+ properties: {
51
+ data: getSchemaData(isListOfEntities, cleanSchemaAttributes(attributes)),
52
+ meta: getMeta(isListOfEntities),
53
+ },
54
+ };
55
+ }
56
+
57
+ return {
58
+ responses: {
59
+ '200': {
60
+ content: {
61
+ 'application/json': {
62
+ schema,
63
+ },
64
+ },
65
+ },
66
+ '400': {
67
+ description: 'Bad Request',
68
+ content: {
69
+ 'application/json': {
70
+ schema: errorResponse,
71
+ },
72
+ },
73
+ },
74
+ '401': {
75
+ description: 'Unauthorized',
76
+ content: {
77
+ 'application/json': {
78
+ schema: errorResponse,
79
+ },
80
+ },
81
+ },
82
+ '403': {
83
+ description: 'Forbidden',
84
+ content: {
85
+ 'application/json': {
86
+ schema: errorResponse,
87
+ },
88
+ },
89
+ },
90
+ '404': {
91
+ description: 'Not Found',
92
+ content: {
93
+ 'application/json': {
94
+ schema: errorResponse,
95
+ },
96
+ },
97
+ },
98
+ '500': {
99
+ description: 'Internal Server Error',
100
+ content: {
101
+ 'application/json': {
102
+ schema: errorResponse,
103
+ },
104
+ },
105
+ },
106
+ },
107
+ };
108
+ };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ const buildApiResponses = require('./build-api-responses');
4
+ const buildApiRequests = require('./build-api-requests');
5
+ const builApiEndpointPath = require('./build-api-endpoint-path');
6
+
7
+ module.exports = {
8
+ buildApiResponses,
9
+ buildApiRequests,
10
+ builApiEndpointPath,
11
+ };
@@ -0,0 +1,205 @@
1
+ 'use strict';
2
+
3
+ const _ = require('lodash');
4
+ const getSchemaData = require('./get-schema-data');
5
+
6
+ /**
7
+ * @description - Converts types found on attributes to OpenAPI specific data types
8
+ *
9
+ * @param {object} attributes - The attributes found on a contentType
10
+ * @param {{ typeMap: Map, isRequest: boolean }} opts
11
+ * @returns Attributes using OpenAPI acceptable data types
12
+ */
13
+
14
+ const cleanSchemaAttributes = (attributes, { typeMap = new Map(), isRequest = false } = {}) => {
15
+ const attributesCopy = _.cloneDeep(attributes);
16
+
17
+ for (const prop in attributesCopy) {
18
+ const attribute = attributesCopy[prop];
19
+ if (attribute.default) {
20
+ delete attributesCopy[prop].default;
21
+ }
22
+
23
+ switch (attribute.type) {
24
+ case 'password': {
25
+ if (!isRequest) {
26
+ delete attributesCopy[prop];
27
+ break;
28
+ }
29
+
30
+ attributesCopy[prop] = { type: 'string', format: 'password', example: '*******' };
31
+ break;
32
+ }
33
+ case 'email': {
34
+ attributesCopy[prop] = { type: 'string', format: 'email' };
35
+ break;
36
+ }
37
+ case 'string':
38
+ case 'text':
39
+ case 'richtext': {
40
+ attributesCopy[prop] = { type: 'string' };
41
+ break;
42
+ }
43
+ case 'timestamp': {
44
+ attributesCopy[prop] = { type: 'string', format: 'timestamp', example: Date.now() };
45
+ break;
46
+ }
47
+ case 'time': {
48
+ attributesCopy[prop] = { type: 'string', format: 'time', example: '12:54.000' };
49
+ break;
50
+ }
51
+ case 'date': {
52
+ attributesCopy[prop] = { type: 'string', format: 'date' };
53
+ break;
54
+ }
55
+ case 'datetime': {
56
+ attributesCopy[prop] = { type: 'string', format: 'date-time' };
57
+ break;
58
+ }
59
+ case 'boolean': {
60
+ attributesCopy[prop] = { type: 'boolean' };
61
+ break;
62
+ }
63
+ case 'enumeration': {
64
+ attributesCopy[prop] = { type: 'string', enum: attribute.enum };
65
+ break;
66
+ }
67
+ case 'decimal':
68
+ case 'float': {
69
+ attributesCopy[prop] = { type: 'number', format: 'float' };
70
+ break;
71
+ }
72
+ case 'integer': {
73
+ attributesCopy[prop] = { type: 'integer' };
74
+ break;
75
+ }
76
+ case 'biginteger': {
77
+ attributesCopy[prop] = { type: 'string', pattern: '^\\d*$', example: '123456789' };
78
+ break;
79
+ }
80
+ case 'json': {
81
+ attributesCopy[prop] = {};
82
+ break;
83
+ }
84
+ case 'uid': {
85
+ attributesCopy[prop] = { type: 'string' };
86
+ break;
87
+ }
88
+ case 'component': {
89
+ const componentAttributes = strapi.components[attribute.component].attributes;
90
+
91
+ if (attribute.repeatable) {
92
+ attributesCopy[prop] = {
93
+ type: 'array',
94
+ items: {
95
+ type: 'object',
96
+ properties: {
97
+ ...(isRequest ? {} : { id: { type: 'string' } }),
98
+ ...cleanSchemaAttributes(componentAttributes, { typeMap, isRequest }),
99
+ },
100
+ },
101
+ };
102
+ } else {
103
+ attributesCopy[prop] = {
104
+ type: 'object',
105
+ properties: {
106
+ ...(isRequest ? {} : { id: { type: 'string' } }),
107
+ ...cleanSchemaAttributes(componentAttributes, {
108
+ typeMap,
109
+ isRequest,
110
+ }),
111
+ },
112
+ };
113
+ }
114
+ break;
115
+ }
116
+ case 'dynamiczone': {
117
+ const components = attribute.components.map(component => {
118
+ const componentAttributes = strapi.components[component].attributes;
119
+ return {
120
+ type: 'object',
121
+ properties: {
122
+ ...(isRequest ? {} : { id: { type: 'string' } }),
123
+ __component: { type: 'string' },
124
+ ...cleanSchemaAttributes(componentAttributes, { typeMap, isRequest }),
125
+ },
126
+ };
127
+ });
128
+
129
+ attributesCopy[prop] = {
130
+ type: 'array',
131
+ items: {
132
+ anyOf: components,
133
+ },
134
+ };
135
+ break;
136
+ }
137
+ case 'media': {
138
+ const imageAttributes = strapi.contentType('plugin::upload.file').attributes;
139
+ const isListOfEntities = attribute.multiple;
140
+
141
+ if (isRequest) {
142
+ const oneOfType = {
143
+ oneOf: [{ type: 'integer' }, { type: 'string' }],
144
+ example: 'string or id',
145
+ };
146
+
147
+ attributesCopy[prop] = isListOfEntities ? { type: 'array', items: oneOfType } : oneOfType;
148
+ break;
149
+ }
150
+
151
+ attributesCopy[prop] = {
152
+ type: 'object',
153
+ properties: {
154
+ data: getSchemaData(isListOfEntities, cleanSchemaAttributes(imageAttributes)),
155
+ },
156
+ };
157
+ break;
158
+ }
159
+
160
+ case 'relation': {
161
+ const isListOfEntities = attribute.relation.includes('ToMany');
162
+
163
+ if (isRequest) {
164
+ const oneOfType = {
165
+ oneOf: [{ type: 'integer' }, { type: 'string' }],
166
+ example: 'string or id',
167
+ };
168
+
169
+ attributesCopy[prop] = isListOfEntities ? { type: 'array', items: oneOfType } : oneOfType;
170
+ break;
171
+ }
172
+
173
+ if (!attribute.target || typeMap.has(attribute.target)) {
174
+ attributesCopy[prop] = {
175
+ type: 'object',
176
+ properties: { data: getSchemaData(isListOfEntities, {}) },
177
+ };
178
+ break;
179
+ }
180
+
181
+ typeMap.set(attribute.target, true);
182
+ const targetAttributes = strapi.contentType(attribute.target).attributes;
183
+
184
+ attributesCopy[prop] = {
185
+ type: 'object',
186
+ properties: {
187
+ data: getSchemaData(
188
+ isListOfEntities,
189
+ cleanSchemaAttributes(targetAttributes, { typeMap, isRequest })
190
+ ),
191
+ },
192
+ };
193
+
194
+ break;
195
+ }
196
+ default: {
197
+ throw new Error(`Invalid type ${attribute.type} while generating open api schema.`);
198
+ }
199
+ }
200
+ }
201
+
202
+ return attributesCopy;
203
+ };
204
+
205
+ module.exports = cleanSchemaAttributes;
@@ -0,0 +1,22 @@
1
+ 'use strict';
2
+
3
+ module.exports = {
4
+ type: 'object',
5
+ required: ['error'],
6
+ properties: {
7
+ error: {
8
+ type: 'object',
9
+ properties: {
10
+ status: {
11
+ type: 'integer',
12
+ },
13
+ name: {
14
+ type: 'string',
15
+ },
16
+ message: {
17
+ type: 'string',
18
+ },
19
+ },
20
+ },
21
+ },
22
+ };
@@ -0,0 +1,32 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description Determines the format of the data response
5
+ *
6
+ * @param {boolean} isListOfEntities - Checks for a multiple entities
7
+ * @param {object} attributes - The attributes found on a contentType
8
+
9
+ * @returns object | array of attributes
10
+ */
11
+ module.exports = (isListOfEntities, attributes) => {
12
+ if (isListOfEntities) {
13
+ return {
14
+ type: 'array',
15
+ items: {
16
+ type: 'object',
17
+ properties: {
18
+ id: { type: 'string' },
19
+ attributes: { type: 'object', properties: attributes },
20
+ },
21
+ },
22
+ };
23
+ }
24
+
25
+ return {
26
+ type: 'object',
27
+ properties: {
28
+ id: { type: 'string' },
29
+ attributes: { type: 'object', properties: attributes },
30
+ },
31
+ };
32
+ };
@@ -0,0 +1,84 @@
1
+ 'use strict';
2
+
3
+ module.exports = [
4
+ {
5
+ name: 'sort',
6
+ in: 'query',
7
+ description: 'Sort by attributes ascending (asc) or descending (desc)',
8
+ deprecated: false,
9
+ required: false,
10
+ schema: {
11
+ type: 'string',
12
+ },
13
+ },
14
+ {
15
+ name: 'pagination[withCount]',
16
+ in: 'query',
17
+ description: 'Retun page/pageSize (default: true)',
18
+ deprecated: false,
19
+ required: false,
20
+ schema: {
21
+ type: 'boolean',
22
+ },
23
+ },
24
+ {
25
+ name: 'pagination[page]',
26
+ in: 'query',
27
+ description: 'Page number (default: 0)',
28
+ deprecated: false,
29
+ required: false,
30
+ schema: {
31
+ type: 'integer',
32
+ },
33
+ },
34
+ {
35
+ name: 'pagination[pageSize]',
36
+ in: 'query',
37
+ description: 'Page size (default: 25)',
38
+ deprecated: false,
39
+ required: false,
40
+ schema: {
41
+ type: 'integer',
42
+ },
43
+ },
44
+ {
45
+ name: 'pagination[start]',
46
+ in: 'query',
47
+ description: 'Offset value (default: 0)',
48
+ deprecated: false,
49
+ required: false,
50
+ schema: {
51
+ type: 'integer',
52
+ },
53
+ },
54
+ {
55
+ name: 'pagination[limit]',
56
+ in: 'query',
57
+ description: 'Number of entities to return (default: 25)',
58
+ deprecated: false,
59
+ required: false,
60
+ schema: {
61
+ type: 'integer',
62
+ },
63
+ },
64
+ {
65
+ name: 'fields',
66
+ in: 'query',
67
+ description: 'Fields to return (ex: title,author)',
68
+ deprecated: false,
69
+ required: false,
70
+ schema: {
71
+ type: 'string',
72
+ },
73
+ },
74
+ {
75
+ name: 'populate',
76
+ in: 'query',
77
+ description: 'Relations to return',
78
+ deprecated: false,
79
+ required: false,
80
+ schema: {
81
+ type: 'string',
82
+ },
83
+ },
84
+ ];
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./admin/src').default;
package/strapi-server.js CHANGED
@@ -1,21 +1,3 @@
1
1
  'use strict';
2
2
 
3
- const bootstrap = require('./server/bootstrap');
4
- const policies = require('./server/policies');
5
- const services = require('./server/services');
6
- const routes = require('./server/routes');
7
- const controllers = require('./server/controllers');
8
- const middlewares = require('./server/middlewares');
9
- const config = require('./server/config');
10
-
11
- module.exports = () => {
12
- return {
13
- bootstrap,
14
- config,
15
- routes,
16
- controllers,
17
- middlewares,
18
- policies,
19
- services,
20
- };
21
- };
3
+ module.exports = require('./server');