knuckleswtf / scribe

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

HTML shows one thing an YAML shows another #757

Closed rabol closed 7 months ago

rabol commented 8 months ago

Scribe version

4.25

PHP version

8.2.12

Framework

Laravel

Framework version

10.30.1

Scribe config

type => "laravel"
laravel.docs_url => "/developer/docs"
try_it_out.enabled => false
try_it_out.use_csrf => true
auth.enabled => true
auth.default => true
logo => "/img/logo.png"

What happened?

the yaml file has this enty

'/api/documents/{id}/show': which is incorrect

it comes from this:

/**
     * Get document
     *
     * @urlParam document string required Document id Example: 9909c553-31bf-494b-bde8-41b6eda60400
     */
    public function show(Request $request, string $document)
    {

Docs

rabol commented 7 months ago

actually the

even with this:

#[UrlParam('document', 'string', 'Document to show', required: true, example: '9909c553-31bf-494b-bde8-41b6eda60400')]

the YAML and the doc is wrong

YAML looks like this:

  '/api/documents/{id}/show':

the doc have this

 api/documents/{id}/show
rabol commented 7 months ago

I belive the issue is in the

class UrlParamsNormalizer, method normalizeParameterNamesInRouteUri as it will turn what ever you have into {id}

which would okay if you don't have any @UrlParm or no #[UrlParm] specified for your method

shalvah commented 7 months ago

I think you want https://scribe.knuckles.wtf/laravel/hooks#normalizeendpointurlusing