Comments (25)
@pirex360 You have the wrong package. This is not mpociot/apidoc but knuckleswtf/scribe. It is a completely new package.
from scribe.
Just uninstall the mpociot/laravel-apidoc-generator and install the scribe... but the error continues !!!!
`Argument 1 passed to Knuckles\Scribe\Tools\DocumentationConfig::__construct() must be of the type array, null given, called in /var/www/vhosts/xxxxxxxxx/vendor/knuckleswtf/scribe/src/Commands/GenerateDocumentation.php on line 204
at vendor/knuckleswtf/scribe/src/Tools/DocumentationConfig.php:9
5| class DocumentationConfig
6| {
7| private $data;
8|
9| public function __construct(array $config = [])
10| {
11| $this->data = $config;
12| }
13|
+16 vendor frames
17 artisan:37
Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
`
I clean cache, same results.
from scribe.
Are you using laravel views?? That was the reason why it wouldnt work on my side...
from scribe.
No, in scribe.php 'type' => 'static',
I only change in scribe.php the route match->prefixes to ['api/*']
I dont know if i need to make more modifications on scribe.php....
from scribe.
Did you clear your config cache?
from scribe.
I found out that for some reason it would know about the config/scribe.
The code config('scribe')
was returning null.
After that I php artisan cache:clear
and could run the php artisan scribe:generate
.
Now I am getting another error and could use some help (Docs arent beeing generated):
🚸 warning No bodyParameters() method found in App\Http\Requests\AccreditedCountryRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [GET] api/lists/accreditedcountries
🚸 warning No bodyParameters() method found in App\Http\Requests\CountryRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [GET] api/lists/countries
🚸 warning No bodyParameters() method found in App\Http\Requests\CountryRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [GET] api/lists/regions
🚸 warning No bodyParameters() method found in App\Http\Requests\CountryRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [GET] api/lists/legalforms
🚸 warning No bodyParameters() method found in App\Http\Requests\RegisterRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [GET] api/lists/registers
🔊 info Processed route: [GET] api/lists/departments
🔊 info Processed route: [GET] api/lists/cfs
🔊 info Processed route: [GET] api/lists/exceptionreasons
🔊 info Processed route: [GET] api/lists/fundstructures
🔊 info Processed route: [GET] api/lists/fundtypes
🔊 info Processed route: [GET] api/lists/reportingtypes
🔊 info Processed route: [GET] api/addresses
🚸 warning No bodyParameters() method found in App\Http\Requests\AddressRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/addresses
🔊 info Processed route: [GET] api/addresses/{id}
🔊 info Processed route: [DELETE] api/addresses/{id}
🚸 warning No bodyParameters() method found in App\Http\Requests\AddressRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [PUT] api/addresses/{id}
🔊 info Processed route: [GET] api/uploads/authorisationfileslist
🔊 info Processed route: [GET] api/uploads/cfsfileslist
🚸 warning No bodyParameters() method found in App\Http\Requests\FileRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/uploads/authorisationfilesupload
🚸 warning No bodyParameters() method found in App\Http\Requests\FileRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/uploads/cfsfilesupload
🔊 info Processed route: [GET] api/cart/show
🔊 info Processed route: [GET] api/cart/{cart_id}/show
🔊 info Processed route: [DELETE] api/cart/{cart_id}/delete
🚸 warning No bodyParameters() method found in App\Http\Requests\CompanyRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/cart/company/add
🔊 info Processed route: [GET] api/cart/company/{cart_id}/show
🚸 warning No bodyParameters() method found in App\Http\Requests\CompanyRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [PUT] api/cart/company/{cart_id}/edit
🚸 warning No bodyParameters() method found in App\Http\Requests\FundRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/cart/fund/add
🔊 info Processed route: [GET] api/cart/fund/{cart_id}/show
🚸 warning No bodyParameters() method found in App\Http\Requests\FundRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [PUT] api/cart/fund/{cart_id}/edit
🚸 warning No bodyParameters() method found in App\Http\Requests\LegalEntityRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [POST] api/cart/legalentitypubliclaw/add
🔊 info Processed route: [GET] api/cart/legalentitypubliclaw/{cart_id}/show
🚸 warning No bodyParameters() method found in App\Http\Requests\LegalEntityRequest Scribe will only be able to extract basic information from the rules() method.
🔊 info Processed route: [PUT] api/cart/legalentitypubliclaw/{cart_id}/edit
🔊 info Processed route: [PUT] api/settings/setaddress/{address}
🔊 info Processed route: [PUT] api/settings/setsubscription/{subscription}
🔊 info Processed route: [GET] /
🔊 info Writing source Markdown files to: resources/docs
🔊 info Wrote source Markdown files to: resources/docs
🔊 info Generating API HTML code
Symfony\Component\Yaml\Exception\ParseException : You cannot define a sequence item when in a mapping at line 18 (near "- <a href='http://github.com/knuckleswtf/scribe'>Documentation powered by Scribe ✍</a>").
at C:\laragon\www\LEI-API-Frontend\vendor\symfony\yaml\Parser.php:159
155|
156| $isRef = $mergeNode = false;
157| if ('-' === $this->currentLine[0] && self::preg_match('#^\-((?P<leadspaces>\s+)(?P<value>.+))?$#u', rtrim($this->currentLine), $values)) {
158| if ($context && 'mapping' == $context) {
> 159| throw new ParseException('You cannot define a sequence item when in a mapping.', $this->getRealCurrentLineNb() + 1, $this->currentLine, $this->filename);
160| }
161| $context = 'sequence';
162|
163| if (isset($values['value']) && '&' === $values['value'][0] && self::preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
Exception trace:
1 Symfony\Component\Yaml\Parser::doParse()
C:\laragon\www\LEI-API-Frontend\vendor\symfony\yaml\Parser.php:96
2 Symfony\Component\Yaml\Parser::parse("title:
language_tabs:
- bash
- javascript
includes:
- "./prepend.md"
- "./authentication.md"
- "./groups/*"
- "./errors.md"
- "./append.md"
logo:
toc_footers:
- <a href="./collection.json">View Postman Collection</a>
- <a href='http://github.com/knuckleswtf/scribe'>Documentation powered by Scribe ✍</a>")
C:\laragon\www\LEI-API-Frontend\vendor\mnapoli\front-yaml\src\Bridge\Symfony\SymfonyYAMLParser.php:36
3 Mni\FrontYAML\Bridge\Symfony\SymfonyYAMLParser::parse("title:
language_tabs:
- bash
- javascript
includes:
- "./prepend.md"
- "./authentication.md"
- "./groups/*"
- "./errors.md"
- "./append.md"
logo:
toc_footers:
- <a href="./collection.json">View Postman Collection</a>
- <a href='http://github.com/knuckleswtf/scribe'>Documentation powered by Scribe ✍</a>")
C:\laragon\www\LEI-API-Frontend\vendor\mnapoli\front-yaml\src\Parser.php:78
4 Mni\FrontYAML\Parser::parse("---
title:
language_tabs:
- bash
- javascript
includes:
- "./prepend.md"
- "./authentication.md"
- "./groups/*"
- "./errors.md"
- "./append.md"
logo:
toc_footers:
- <a href="./collection.json">View Postman Collection</a>
- <a href='http://github.com/knuckleswtf/scribe'>Documentation powered by Scribe ✍</a>
---
# Introduction
Welcome to our API documentation!
<aside>As you scroll, you'll see code examples for working with the API in different programming languages in the dark area to the right (or as part of the content on mobile), and you can switch the programming language of the examples with the tabs in the top right (or from the nav menu at the top left on mobile).</aside>
")
C:\laragon\www\LEI-API-Frontend\vendor\knuckleswtf\pastel\src\Pastel.php:64
5 Knuckles\Pastel\Pastel::generate("resources/docs", "public/docs")
C:\laragon\www\LEI-API-Frontend\vendor\knuckleswtf\scribe\src\Writing\Writer.php:226
6 Knuckles\Scribe\Writing\Writer::writeHtmlDocs()
C:\laragon\www\LEI-API-Frontend\vendor\knuckleswtf\scribe\src\Writing\Writer.php:103
7 Knuckles\Scribe\Writing\Writer::writeDocs(Object(Illuminate\Support\Collection))
C:\laragon\www\LEI-API-Frontend\vendor\knuckleswtf\scribe\src\Commands\GenerateDocumentation.php:83
8 Knuckles\Scribe\Commands\GenerateDocumentation::handle(Object(Knuckles\Scribe\Matching\RouteMatcher))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32
9 call_user_func_array()
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:32
10 Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\Util.php:36
11 Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:90
12 Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Object(Closure))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\BoundMethod.php:34
13 Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), [])
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Container\Container.php:590
14 Illuminate\Container\Container::call()
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Console\Command.php:134
15 Illuminate\Console\Command::execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
C:\laragon\www\LEI-API-Frontend\vendor\symfony\console\Command\Command.php:255
16 Symfony\Component\Console\Command\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Console\Command.php:121
17 Illuminate\Console\Command::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\vendor\symfony\console\Application.php:1000
18 Symfony\Component\Console\Application::doRunCommand(Object(Knuckles\Scribe\Commands\GenerateDocumentation), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\vendor\symfony\console\Application.php:271
19 Symfony\Component\Console\Application::doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\vendor\symfony\console\Application.php:147
20 Symfony\Component\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Console\Application.php:93
21 Illuminate\Console\Application::run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php:131
22 Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
C:\laragon\www\LEI-API-Frontend\artisan:37
from scribe.
If I set the postman.enable to false in the config, the documentation will at least get generated.
I am just thinking that i might have weird chars somewhere or the parser isnt working properly.
Even the generated documentation looks weird.
Please help me !!!
from scribe.
Hey, I can take a look at this for you, but you'll have to wait until I'm free later in the day. I can see from your earlier problem that it was an indentation issue, but not sure of the cause.
In the meantime, please follow the issue template and post your Scribe config and system details. If you're looking for something to try, I'd recommend backing up your config and regenerating the config file and trying again.
from scribe.
Hey, I have already deleted my config file and generated it again, but the problem persists.
I have deleted resources/docs and generated again, the problem still persists.
I am thinking that I might have a problem somewhere in my phpDocs.
If I can't fix it I could send you my project if you want.
from scribe.
Hey there,
I found out where the problem was...
I generated view files, but in the config I had set that I want a static documentation.
Maybe you have to put a check, that if the documentation is static, to not read the view files at all.
Now I have another question and here are my examples:
Controller:
<?php
namespace App\Http\Controllers\Lists;
use App\Http\Controllers\Controller;
use App\Http\Requests\RegisterRequest;
use App\Http\Resources\RegisterResource;
use App\Models\Register;
/**
* @group Lists
*
* Needed lists for generating a LEI
*/
class RegisterController extends Controller
{
/**
* Registers
*
* List of registers.
*
* @urlParam country ISO 3166-1 Alpha-2 (country_code) for a specific country.
* @urlParam filter Filter profile register (Allowed: company, fund and legalentitypubliclaw)
*
* @param RegisterRequest $request
* @return \Illuminate\Http\Resources\Json\AnonymousResourceCollection
*/
public function showRegisters(RegisterRequest $request)
{
return RegisterResource::collection(
Register::allRegisters($request->country, $request->filter)
);
}
}
Request:
<?php
namespace App\Http\Requests;
use App\Rules\IsValidCountryRule;
use App\Rules\IsValidRegisterFilterRule;
use Illuminate\Foundation\Http\FormRequest;
class RegisterRequest extends FormRequest
{
public function rules()
{
return [
'country' => ['sometimes', 'required', 'alpha', 'max:2', new IsValidCountryRule()],
'filter' => ['sometimes', 'required', 'alpha', new IsValidRegisterFilterRule],
];
}
public function authorize()
{
return true;
}
}
The problem is, that the documentation is looking at my Request (it is awesome, but not in this case) and it is documenting my URL Parameter also as Body Parameters.
In this example I am using a FormRequest to validate the URL Parameters. Your code is working as intended, but I think we need a way to say, not to look in the FormRequests.
Thanks in advance for your help.
from scribe.
Hey, if you'd like to disable form request parsing, you can simply remove the FormRequest strategy in the config file.
(I also wasn't aware URL parameters were included in form request validation. Hmm. 🤔)
from scribe.
No, it is not your fault. It is working as intended.
My problem is, that I wanted to validate the URL parameters. (Almost nobody does this)
I just want a way to deactivate the FormRequest strategy for some routes.
from scribe.
Sure, you can edit the list of strategies used in the config file.
from scribe.
Using artisan command : php artisan apidoc:generate same error occurs ::
` TypeError
Argument 1 passed to Mpociot\ApiDoc\Tools\DocumentationConfig::__construct() must be of the type array, null given, called in /var/www/vhosts/xxxxxxxxxx/vendor/mpociot/laravel-apidoc-generator/src/Commands/GenerateDocumentation.php on line 61
at vendor/mpociot/laravel-apidoc-generator/src/Tools/DocumentationConfig.php:9
5| class DocumentationConfig
6| {
7| private $data;
8|
9| public function __construct(array $config = [])
10| {
11| $this->data = $config;
12| }
13|
`
from scribe.
Thanks, i try out scribe...because mpociot/laravel-apidoc-generator dont work for some reason... i see scribe its his sucessor.
from scribe.
I see you mentioned that you did that. Are you on Lumen? Did you do $app->configure('scribe')
?
from scribe.
Hurray, you save my day :)
I was clearing the cache "php artisan cache:clear", not the config cache.... *
solution : php artisan config:clear
Thank you very much.
*why this little things are not included in the oficial docs ?!
from scribe.
I'll add it as a troubleshooting tip, but it isn't something that happens for everyone. Normally, Laravel should only cache config on production.
from scribe.
Good choice, include in a troubleshooting tip section !
Thanks for all support.
from scribe.
https://scribe.readthedocs.io/en/latest/troubleshooting.html#try-clearing-any-cached-config
from scribe.
Use
php artisan optimize:clear, after installing this package and before generating docs files.
from scribe.
Try php artisan scribe:generate --force
.
If you change something in index.md
- this library will generate a doc based on the changed files.
In my case, I accidentally inserted a random symbol into the index.md
file and my IDE saved this.
Hope helped someone.
from scribe.
Anyone have idea about this issue?
from scribe.
Here's your solution @michaelandrew123 : https://scribe.knuckles.wtf/laravel/hooks#instantiateformrequestusing
If your FormRequest needs Scribe to pass parameters to it, set it up using Scribe::instantiateFormRequestUsing()
from scribe.
@shalvah I'm having the same issue as above and this is what I have:
ArgumentCountError
Too few arguments to function App\Services\IncotermService::__construct(), 0 passed in /Users/salvationarinze/PycharmProjects/jetstream-services/backend/jetvision/vendor/knuckleswtf/scribe/camel/Extraction/ExtractedEndpointData.php on line 218 and exactly 1 expected
at app/Services/IncotermService.php:11
7▕
8▕ class IncotermService
9▕ {
10▕
➜ 11▕ public function __construct(
12▕ private Incoterm $incoterm
13▕ ) {}
14▕
15▕ public function fetchAll(): Collection {
Using Scribe::instantiateFormRequestUsing
not working probably cos its not a form request. How do I handle this
from scribe.
Related Issues (20)
- Manipulate tags by Plugins HOT 2
- Annotation example for boolean values doesn't work correctly HOT 3
- How to write multiple examples in response body? HOT 3
- Try it out base url HOT 2
- API Guide HOT 3
- only name & example supported in the header HOT 1
- Always ask to remove external.html_attributes.* on scribe:generate for no reason HOT 2
- Strategy ResponseCalls running on all endpoints instead of only GET endpoints HOT 4
- getting 401 Unauthorized in each routes where i set the middleware HOT 1
- Plugin List?
- How to override post-response script content for the postman? HOT 1
- Using @apiResource as a @bodyParam? HOT 1
- scalar theme doesnt properly generate example and child attributes HOT 1
- array request not render and not examplae
- Example is not using factory HOT 1
- Missing 'Accept' => 'application/json' HOT 5
- How to send NULL values? HOT 2
- Support wider range of types
- How use recursive schema ? HOT 1
- 404 Not Found on Production HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scribe.