knuckleswtf / scribe

Generate API documentation for humans from your Laravel codebase.✍
https://scribe.knuckles.wtf/laravel/
MIT License
1.58k stars 280 forks source link

theme 'elements' doesn't display properly #779

Open sprklinginfo opened 6 months ago

sprklinginfo commented 6 months ago

Scribe version

4.28.0

PHP version

8.1

Framework

Laravel

Framework version

10.37.3

Scribe config

when running the diff command, I got the following error:

 ErrorException

  Array to string conversion

  at vendor/knuckleswtf/scribe/src/Tools/ConfigDiffer.php:62
     58▕         if (!is_array($oldValue)) {
     59▕             return "changed to a list";
     60▕         }
     61▕
  ➜  62▕         $added = array_map(fn ($v) => "$v", array_diff($value, $oldValue));
     63▕         $removed = array_map(fn ($v) => "$v", array_diff($oldValue, $value));
     64▕
     65▕         $diff = [];
     66▕         if (!empty($added)) {

      +17 vendor frames

  18  artisan:37
```.
I changed the following lines in `config/scribe.php`:
'type' => 'laravel',
'theme' => 'elements',
'docs_url' => '/apidocs',
 'order' => [
            'User Auth',
            'Slips'
        ],

What happened?

when using the 'elements' theme, the pages are generated and displayed incorrectly. but if I switched back to the 'default' the pages look fine. Please see the attached screenshots: the 1st is taken from 'elements', and the 2nd is taken from 'default' Snipaste_2023-12-28_11-46-36

Snipaste_2023-12-28_11-58-52

Docs

shalvah commented 6 months ago

Sorry about that! Unfortunately, I can't promise any timeline for when this will be fixed, as I'm quite busy. However, if you'd like to use the elements theme, you can try upgrading to v4.29 and switching type to external_laravel. This uses the CSS + JavaScript directly from Elements, so there shouldn't be any rendering issues from our side. The only difference is that the doc is fetched and rendered client-side based on your OpenAPI spec.