Giter Site home page Giter Site logo

FatalThrowableError? about scribe HOT 25 CLOSED

knuckleswtf avatar knuckleswtf commented on August 23, 2024
FatalThrowableError?

from scribe.

Comments (25)

K2ouMais avatar K2ouMais commented on August 23, 2024 1

@pirex360 You have the wrong package. This is not mpociot/apidoc but knuckleswtf/scribe. It is a completely new package.

from scribe.

pirex360 avatar pirex360 commented on August 23, 2024 1

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.

K2ouMais avatar K2ouMais commented on August 23, 2024 1

Are you using laravel views?? That was the reason why it wouldnt work on my side...

from scribe.

pirex360 avatar pirex360 commented on August 23, 2024 1

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.

shalvah avatar shalvah commented on August 23, 2024 1

Did you clear your config cache?

from scribe.

K2ouMais avatar K2ouMais commented on August 23, 2024

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.

K2ouMais avatar K2ouMais commented on August 23, 2024

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 !!!

Anmerkung 2020-06-16 161755

from scribe.

shalvah avatar shalvah commented on August 23, 2024

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.

K2ouMais avatar K2ouMais commented on August 23, 2024

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.

K2ouMais avatar K2ouMais commented on August 23, 2024

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.

Anmerkung 2020-06-17 090527

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.

shalvah avatar shalvah commented on August 23, 2024

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.

K2ouMais avatar K2ouMais commented on August 23, 2024

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.

shalvah avatar shalvah commented on August 23, 2024

Sure, you can edit the list of strategies used in the config file.

from scribe.

pirex360 avatar pirex360 commented on August 23, 2024

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.

pirex360 avatar pirex360 commented on August 23, 2024

Thanks, i try out scribe...because mpociot/laravel-apidoc-generator dont work for some reason... i see scribe its his sucessor.

from scribe.

shalvah avatar shalvah commented on August 23, 2024

I see you mentioned that you did that. Are you on Lumen? Did you do $app->configure('scribe')?

from scribe.

pirex360 avatar pirex360 commented on August 23, 2024

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.

shalvah avatar shalvah commented on August 23, 2024

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.

pirex360 avatar pirex360 commented on August 23, 2024

Good choice, include in a troubleshooting tip section !

Thanks for all support.

from scribe.

shalvah avatar shalvah commented on August 23, 2024

https://scribe.readthedocs.io/en/latest/troubleshooting.html#try-clearing-any-cached-config

from scribe.

gargashwani avatar gargashwani commented on August 23, 2024

Use

php artisan optimize:clear, after installing this package and before generating docs files.

from scribe.

mrzlanx532 avatar mrzlanx532 commented on August 23, 2024

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.

michaelandrew123 avatar michaelandrew123 commented on August 23, 2024

Anyone have idea about this issue?
image

from scribe.

shalvah avatar shalvah commented on August 23, 2024

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.

salvationarinze avatar salvationarinze commented on August 23, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.