knuckleswtf / scribe

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

Menu items not expanding when using #[BodyParam] #677

Closed wessama closed 1 year ago

wessama commented 1 year ago

Scribe version

4.21.0

PHP version

8.2.6

Framework

Laravel

Framework version

9.52.8

Scribe config

theme => "elements"
title => "xxx"
type => "laravel"
auth.enabled => true
auth.default => true
auth.name => "Authorization"
logo => "assets/media/logos/full-logo.png"

What happened?

docs:251 Uncaught TypeError: hljs.highlightElement is not a function
    at docs:251:25
    at CodeJar (codejar.js:19:5)
    at docs:246:67
    at NodeList.forEach (<anonymous>)
    at docs:246:51

Sidebar doesn't show any menu items when using #[BodyParam] PHP 8.x attributes. I also get the above console error. I get this behavior for the default and element themes. Removing the attributes resolves the issue.

My controller method:

#[Group("Authentication", "APIs for authenticating users")]
#[Subgroup("Users", "Authenticate as a user")]
class UserAuthenticationController extends ApiController
{
    #[Endpoint("Sign in")]
    #[Unauthenticated]
    #[BodyParam('param', 'string', 'description', example: '111-11-1111')]
    #[BodyParam('param', 'string', 'description', example: '111-111-1111')]
    public function signIn(SignInData $data) {}
}

Worth noting I'm using Spatie/laravel-data for DTOs so that's a Spatie\LaravelData\Data object being injected instead of a FormRequest.

Docs

shalvah commented 1 year ago

Tried any of these? https://github.com/knuckleswtf/scribe/issues/569#issuecomment-1326779362

shalvah commented 1 year ago

https://scribe.knuckles.wtf/laravel/troubleshooting#typeerror-hljshighlightelement--hljshighlightall-is-not-a-function

wessama commented 1 year ago

@shalvah Ah, now I feel dumb. Thank you, that fixed it.