updated documentationDefault/apiBlueprint
This commit is contained in:
parent
0a3d4d9a0a
commit
ed771b20a9
|
@ -5,7 +5,7 @@
|
|||
use \error\core\Err;
|
||||
use \manager\ResourceDispatcher;
|
||||
|
||||
class module{
|
||||
class documentationDefault{
|
||||
|
||||
public function __construct(){}
|
||||
public function __destruct(){}
|
||||
|
@ -87,7 +87,7 @@
|
|||
/* [0] Récupération de la configuration
|
||||
=========================================================*/
|
||||
// On récupère le fichier et on le parse
|
||||
$modules = json_decode( file_get_contents(__ROOT__/'/config/modules.json'), true );
|
||||
$modules = json_decode( file_get_contents(__CONFIG__.'/modules.json'), true );
|
||||
|
||||
// Gestion de l'erreur de parsage
|
||||
if( $modules == null )
|
||||
|
@ -185,8 +185,9 @@
|
|||
/* (1) Description */
|
||||
$content .= "### $methName [POST /$module/$methName]\n\n";
|
||||
$content .= $method['description']."\n";
|
||||
if( count($method['permissions']) > 0)
|
||||
$content .= '> Permissions `'.implode('``', $method['permissions'])."`\n\n";
|
||||
if( count($method['permissions']) > 0 )
|
||||
foreach($method['permissions'] as $perm_set)
|
||||
$content .= '> Permissions `'.implode('``', $perm_set)."`\n\n";
|
||||
|
||||
// Liste des paramètres
|
||||
if( isset($method['parameters']) && count($method['parameters']) > 0 ){
|
||||
|
@ -194,7 +195,7 @@
|
|||
$content .= "+ Parameters\n\n";
|
||||
foreach($method['parameters'] as $argName=>$argument){
|
||||
$optional = isset($argument['optional']) && $argument['optional'] === true;
|
||||
$content .= " + $argName (${argument['type']}, ".( $optional ? 'optional' : 'required' ).") - ${argument['description']}\n";
|
||||
$content .= " + $argName (".$argument['type'].", ".( $optional ? 'optional' : 'required' ).") - ".(isset($argument['description']) ? $argument['description'] : 'none')."\n";
|
||||
}
|
||||
$content .= "\n";
|
||||
}
|
||||
|
@ -252,7 +253,7 @@
|
|||
// On explicite tous les paramètres
|
||||
$content .= " + Attributes (object)\n\n";
|
||||
foreach($method['output'] as $outName=>$outData)
|
||||
$content .= " + $outName (${outData['type']}) - ${outData['description']}\n";
|
||||
$content .= " + $outName (".$outData['type'].") - ".(isset($outData['description']) ? $outData['description'] : 'none')."\n";
|
||||
}
|
||||
|
||||
$content .= "\n\n";
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
|
||||
"module": {
|
||||
"documentationDefault": {
|
||||
|
||||
"POST::apiBlueprint": {
|
||||
"description": "Retourne une documentation de l'API au format API Blueprint.",
|
||||
|
|
Loading…
Reference in New Issue