Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for theme-specific API request/response examples in Logical Theme System #5182

Open
1 task done
ln-ws opened this issue Aug 27, 2024 · 2 comments
Open
1 task done

Comments

@ln-ws
Copy link

ln-ws commented Aug 27, 2024

Describe the feature you'd like

Implement a mechanism for BookStack to recognize and utilize API request/response examples stored within custom themes using the Logical Theme System. Currently, these examples must be manually linked to the /dev/api/requests and /dev/api/responses folders. We propose two possible solutions:

  1. Automatically search for examples within the theme's directory structure, specifically in subfolders like /dev/api/requests and /dev/api/responses.
  2. Allow themes to register their own examples through a defined API or configuration file.

Describe the benefits this would bring to existing BookStack users

  1. Improved documentation: API examples would be more easily maintained and updated alongside the theme code, ensuring better synchronization between functionality and documentation.
  2. Simplified theme management: Users would no longer need to manually create symlinks, reducing the potential for errors and streamlining the theme installation process.
  3. Better organization: Keeping all theme-related content, including API examples, within the theme's directory structure improves code organization and makes it easier to distribute and version control themes as complete packages.
  4. Enhanced developer experience: Theme developers would have a more intuitive and standardized way to include API examples, potentially encouraging more comprehensive documentation.
  5. Easier theme sharing and installation: Themes could be shared as complete packages, including all necessary documentation and examples, making it simpler for users to install and use custom themes.

Can the goal of this request already be achieved via other means?

Yes, the goal can currently be achieved by manually creating symlinks from the theme's examples to the /dev/api/requests and /dev/api/responses folders.

Have you searched for an existing open/closed issue?

  • I have searched for existing issues and none cover my fundamental request

How long have you been using BookStack?

3 months to 1 year

Additional context

No response

@ssddanbrown
Copy link
Member

Thanks for the request @ln-ws, can you explain the actual real-world use-case where this is desired?

I'd just like to understand the scenario where it'd important to ensure additional added API endpoints have their own examples built in.

@zivillian
Copy link

We wrote a logical theme which (besides other customizations) extends the api to include endpoints for token management. We are working with multiple person on extending the Logical Theme, implementing an api client and integrating the functionality in our solution. When working in a team it's great to have the api documentation in a single place.

We are versioning our theme in git. We need to install our theme in multiple bookstack instances (dev, test, prod). Our current process is to create symlinks after cloning our repository:

ln -s ../../../themes/Our.Theme/dev/api/requests/tokens-create.json dev/api/requests/.
ln -s ../../../themes/Our.Theme/dev/api/requests/tokens-update.json dev/api/requests/.

ln -s ../../../themes/Our.Theme/dev/api/responses/tokens-create.json dev/api/responses/.
ln -s ../../../themes/Our.Theme/dev/api/responses/tokens-list.json dev/api/responses/.
ln -s ../../../themes/Our.Theme/dev/api/responses/tokens-read.json dev/api/responses/.
ln -s ../../../themes/Our.Theme/dev/api/responses/tokens-update.json dev/api/responses/.

Another scenario is publishing an api extension to the BookStack Hacks Directory - it would be great if the hack also contains the documentation and examples for new API endpoints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants