knuckleswtf / scribe

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

Approach to multi-tenancy docs #721

Closed onovaes closed 1 year ago

onovaes commented 1 year ago

Scribe version

4.23.1

Your question

I'm making a multitenant application with package (/spatie/laravel-multitenancy) and generating static documentation.

When I access /docs/ the Base URL always get the APP_URL.

How do I generate each /docs/ with Base URL correct for each tenant?

What is the best approach to multi-tenancy?

Docs

shalvah commented 1 year ago

Hmm, I don't have an answer out of the box for you. First thing is that you should definitely be using laravel type, because that's the only way you can add some dynamic behaviour to your docs.

I'd advise you to read the docs about the URLs Scribe uses (displaying vs Try It Out vs response calls), if you haven't already done so.

My guess is that you can use laravel type and customise the generated Blade views to display a dynamic base URL instead, or something like that. Or you could even set base_url to a dynamic string, like 'config ("app.tenant_url"). It might work.

shalvah commented 1 year ago

Or you could even set base_url to a dynamic string, like 'config ("app.tenant_url"). It might work

Okay, tested it and it doesn't work. But pushed a patch to master and it sort of does, now. Can you test that out?