strapi-plugin-documentation
Advanced tools
Comparing version 3.0.0-alpha.24.1 to 3.0.0-alpha.25
@@ -5,4 +5,5 @@ import React from 'react'; | ||
import cn from 'classnames'; | ||
import Button from 'components/Button'; | ||
import openWithNewTab from 'utils/openWithNewTab'; | ||
import openWithNewTab from '../../utils/openWithNewTab'; | ||
import styles from './styles.scss'; | ||
@@ -46,2 +47,2 @@ | ||
export default ButtonContainer; | ||
export default ButtonContainer; |
@@ -11,6 +11,6 @@ /** | ||
// Utils | ||
import pluginId from 'pluginId'; | ||
import pluginId from '../../pluginId'; | ||
// Containers | ||
import HomePage from 'containers/HomePage'; | ||
import NotFoundPage from 'containers/NotFoundPage'; | ||
import HomePage from '../HomePage'; | ||
import NotFoundPage from '../NotFoundPage'; | ||
@@ -17,0 +17,0 @@ function App() { |
@@ -15,13 +15,19 @@ /* | ||
import cn from 'classnames'; | ||
import pluginId from 'pluginId'; | ||
// Components | ||
import PluginHeader from 'components/PluginHeader'; | ||
import PopUpWarning from 'components/PopUpWarning'; | ||
import Block from 'components/Block'; | ||
import Row from 'components/Row'; | ||
import LoadingIndicatorPage from 'components/LoadingIndicatorPage'; | ||
import Input from 'components/InputsIndex'; | ||
// Utils | ||
import auth from 'utils/auth'; | ||
import openWithNewTab from 'utils/openWithNewTab'; | ||
import pluginId from '../../pluginId'; | ||
import Block from '../../components/Block'; | ||
import Row from '../../components/Row'; | ||
import openWithNewTab from '../../utils/openWithNewTab'; | ||
// Actions | ||
@@ -28,0 +34,0 @@ import { |
import { createSelector } from 'reselect'; | ||
import pluginId from 'pluginId'; | ||
import pluginId from '../../pluginId'; | ||
@@ -4,0 +4,0 @@ /** |
{ | ||
"name": "strapi-plugin-documentation", | ||
"version": "3.0.0-alpha.24.1", | ||
"version": "3.0.0-alpha.25", | ||
"description": "This is the description of the plugin.", | ||
@@ -20,5 +20,5 @@ "strapi": { | ||
"generate": "node ./node_modules/plop/plop.js --plopfile node_modules/strapi-helper-plugin/lib/internals/generators/index.js", | ||
"lint": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-helper-plugin/lib/internals/eslint/.eslintrc.json admin", | ||
"lint": "node ./node_modules/strapi-lint/node_modules/.bin/eslint --ignore-path .gitignore --ignore-pattern '/admin/build/' --config ./node_modules/strapi-lint/lib/internals/eslint/.eslintrc.json admin", | ||
"prettier": "node ./node_modules/strapi-helper-plugin/node_modules/.bin/prettier --single-quote --trailing-comma es5 --write \"{admin,__{tests,mocks}__}/**/*.js\"", | ||
"test": "npm run lint", | ||
"test": "echo \"no tests yet\"", | ||
"prepublishOnly": "IS_MONOREPO=true npm run build" | ||
@@ -35,3 +35,3 @@ }, | ||
"rimraf": "^2.6.3", | ||
"strapi-helper-plugin": "3.0.0-alpha.24.1" | ||
"strapi-helper-plugin": "3.0.0-alpha.25" | ||
}, | ||
@@ -38,0 +38,0 @@ "author": { |
@@ -372,3 +372,9 @@ 'use strict'; | ||
const endPoint = this.formatApiEndPoint(current.path); | ||
const verb = current.method.toLowerCase(); | ||
let verb; | ||
if (Array.isArray(current.method)) { | ||
verb = current.method.map((method) => method.toLowerCase()); | ||
} else { | ||
verb = current.method.toLowerCase(); | ||
} | ||
// The key corresponds to firsts keys of the returned object | ||
@@ -408,5 +414,12 @@ let key; | ||
_.set(acc, [key, 'paths', endPoint, verb], verbObject); | ||
// Swagger is not support key with ',' symbol, for array of methods need generate documentation for each method | ||
if (Array.isArray(verb)) { | ||
verb.forEach((method) => { | ||
_.set(acc, [key, 'paths', endPoint, method], verbObject); | ||
}); | ||
} else { | ||
_.set(acc, [key, 'paths', endPoint, verb], verbObject); | ||
} | ||
if (verb === 'post' || verb === 'put') { | ||
if (verb.includes('post') || verb.includes('put')) { | ||
let requestBody; | ||
@@ -444,3 +457,17 @@ | ||
_.set(acc, [key, 'paths', endPoint, verb, 'requestBody'], requestBody); | ||
if (Array.isArray(verb)) { | ||
verb.forEach((method) => { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, method, 'requestBody'], | ||
requestBody, | ||
); | ||
}); | ||
} else { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, verb, 'requestBody'], | ||
requestBody, | ||
); | ||
} | ||
} | ||
@@ -451,4 +478,14 @@ | ||
if (verb !== 'post') { | ||
_.set(acc, [key, 'paths', endPoint, verb, 'parameters'], parameters); | ||
if (!verb.includes('post')) { | ||
if (Array.isArray(verb)) { | ||
verb.forEach((method) => { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, method, 'parameters'], | ||
parameters, | ||
); | ||
}); | ||
} else { | ||
_.set(acc, [key, 'paths', endPoint, verb, 'parameters'], parameters); | ||
} | ||
} | ||
@@ -521,3 +558,3 @@ | ||
? ['plugins', currentAssociation.plugin, 'models', name, 'attributes'] | ||
: ['models', name, 'attributes']; | ||
: ['models', name.toLowerCase(), 'attributes']; | ||
const associationAttributes = _.get(strapi, getter); | ||
@@ -563,3 +600,10 @@ const associationSchema = this.generateAssociationSchema(associationAttributes, getter); | ||
: this.formatApiEndPoint(`${prefix}${current.path}`); | ||
const verb = current.method.toLowerCase(); | ||
let verb; | ||
if (Array.isArray(current.method)) { | ||
verb = current.method.map((method) => method.toLowerCase()); | ||
} else { | ||
verb = current.method.toLowerCase(); | ||
} | ||
const actionType = _.get(current, ['config', 'tag', 'actionType'], ''); | ||
@@ -600,7 +644,21 @@ let key; | ||
if (_.isEmpty(defaultDocumentation)) { | ||
if (verb !== 'post') { | ||
_.set(acc, [key, 'paths', endPoint, verb, 'parameters'], parameters); | ||
if (!verb.includes('post')) { | ||
if (Array.isArray(verb)) { | ||
verb.forEach((method) => { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, method, 'parameters'], | ||
parameters, | ||
); | ||
}); | ||
} else { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, verb, 'parameters'], | ||
parameters, | ||
); | ||
} | ||
} | ||
if (verb === 'post' || verb === 'put') { | ||
if (verb.includes('post') || verb.includes('put')) { | ||
let requestBody; | ||
@@ -643,3 +701,18 @@ | ||
} | ||
_.set(acc, [key, 'paths', endPoint, verb, 'requestBody'], requestBody); | ||
if (Array.isArray(verb)) { | ||
verb.forEach((method) => { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, method, 'requestBody'], | ||
requestBody, | ||
); | ||
}); | ||
} else { | ||
_.set( | ||
acc, | ||
[key, 'paths', endPoint, verb, 'requestBody'], | ||
requestBody, | ||
); | ||
} | ||
} | ||
@@ -943,14 +1016,19 @@ } | ||
const isModelRelated = strapi.models[tag] !== undefined && tag === endPoint; | ||
if (Array.isArray(verb)) { | ||
verb = verb.map((method) => method.toLocaleLowerCase()); | ||
} | ||
switch (verb.toLocaleLowerCase()) { | ||
case 'get': | ||
case 'post': | ||
case 'put': | ||
return isModelRelated ? `Retrieve ${tag} document(s)` : 'response'; | ||
case 'delete': | ||
return isModelRelated | ||
? `deletes a single ${tag} based on the ID supplied` | ||
: 'deletes a single record based on the ID supplied'; | ||
default: | ||
return 'response'; | ||
if ( | ||
verb.includes('get') || | ||
verb.includes('put') || | ||
verb.includes('post') | ||
) { | ||
return isModelRelated ? `Retrieve ${tag} document(s)` : 'response'; | ||
} else if (verb.includes('delete')) { | ||
return isModelRelated | ||
? `deletes a single ${tag} based on the ID supplied` | ||
: 'deletes a single record based on the ID supplied'; | ||
} else { | ||
return 'response'; | ||
} | ||
@@ -1092,3 +1170,23 @@ }, | ||
} | ||
if (Array.isArray(verb)) { | ||
const [, controllerMethod] = handler.split('.'); | ||
if ( | ||
(verb.includes('get') && verb.includes('post')) || | ||
controllerMethod === 'findOrCreate' | ||
) { | ||
return `Find or create ${tag} record`; | ||
} | ||
if ( | ||
(verb.includes('put') && verb.includes('post')) || | ||
controllerMethod === 'createOrUpdate' | ||
) { | ||
return `Create or update ${tag} record`; | ||
} | ||
return ''; | ||
} | ||
switch (verb) { | ||
@@ -1326,2 +1424,3 @@ case 'get': { | ||
case 'integer': | ||
case 'biginteger': | ||
case 'long': | ||
@@ -1328,0 +1427,0 @@ return 'integer'; |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1140734
6910
3