Skip to content

Commit

Permalink
#334 #413 fix template name conflict with swagger
Browse files Browse the repository at this point in the history
  • Loading branch information
mitulgolakiya committed Nov 21, 2017
1 parent 8f28e77 commit 9bbee3b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Generators/API/APIControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ private function fillDocs($templateData)
$methods = ['controller', 'index', 'store', 'show', 'update', 'destroy'];

if ($this->commandData->getAddOn('swagger')) {
$templatePrefix = 'controller';
$templatePrefix = 'controller_docs';
$templateType = 'swagger-generator';
} else {
$templatePrefix = 'api.docs.controller';
Expand Down
4 changes: 2 additions & 2 deletions src/Generators/ModelGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,14 @@ public function generateSwagger($templateData)
{
$fieldTypes = SwaggerGenerator::generateTypes($this->commandData->fields);

$template = get_template('model.model', 'swagger-generator');
$template = get_template('model_docs.model', 'swagger-generator');

$template = fill_template($this->commandData->dynamicVars, $template);

$template = str_replace('$REQUIRED_FIELDS$',
'"'.implode('"'.', '.'"', $this->generateRequiredFields()).'"', $template);

$propertyTemplate = get_template('model.property', 'swagger-generator');
$propertyTemplate = get_template('model_docs.property', 'swagger-generator');

$properties = SwaggerGenerator::preparePropertyFields($propertyTemplate, $fieldTypes);

Expand Down
4 changes: 2 additions & 2 deletions src/Generators/SwaggerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ public static function generateTypes($inputFields)

public static function generateSwagger($fields, $fillables, $variables)
{
$template = get_template('model.model', 'swagger-generator');
$template = get_template('model_docs.model', 'swagger-generator');

$templateData = fill_template($variables, $template);

$templateData = str_replace('$REQUIRED_FIELDS$', '"'.implode('", "', $fillables).'"', $templateData);

$propertyTemplate = get_template('model.property', 'swagger-generator');
$propertyTemplate = get_template('model_docs.property', 'swagger-generator');

$properties = self::preparePropertyFields($propertyTemplate, $fields);

Expand Down
2 changes: 1 addition & 1 deletion src/Generators/VueJs/ControllerGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private function fillDocs($templateData)
$methods = ['controller', 'index', 'store', 'show', 'update', 'destroy'];

if ($this->commandData->getAddOn('swagger')) {
$templatePrefix = 'controller';
$templatePrefix = 'controller_docs';
$templateType = 'swagger-generator';
} else {
$templatePrefix = 'api.docs.controller';
Expand Down

0 comments on commit 9bbee3b

Please sign in to comment.