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

Introduce ScalarUI #6545

Open
valentimarco opened this issue Aug 24, 2024 · 3 comments
Open

Introduce ScalarUI #6545

valentimarco opened this issue Aug 24, 2024 · 3 comments

Comments

@valentimarco
Copy link

Description
I really like this new interactive API documentation call ScalarUI and would be great to add it

Example
At the moment I implemented using Twig Replacement

@soyuka
Copy link
Member

soyuka commented Aug 29, 2024

Would you be able to document this? Thanks!

@valentimarco
Copy link
Author

valentimarco commented Aug 29, 2024

What should i do document? i can describe what i did to make that possible:

  1. Create a twig file under /templates/bundles/ApiPlatformBundle/SwaggerUi/index.html.twig
  2. Copy the html below:
  {# templates/bundles/ApiPlatformBundle/SwaggerUi/index.html.twig #}
  {% set openApiJson = swagger_data["spec"] %}
  <!doctype html>
  <html>
  <head>
      <title>Scalar API Reference</title>
      <meta charset="utf-8"/>
      <meta
              name="viewport"
              content="width=device-width, initial-scale=1"/>
  </head>
  <body>
  <script
          id="api-reference"
          type="application/json">{{ openApiJson| json_encode | raw }}</script>
  <script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> 
  </body>
  </html>
  1. Under api_platform.yaml, define the following properties: tittle, description and version.

I tested using a Jwt token in a custom header as authentication

@soyuka
Copy link
Member

soyuka commented Aug 30, 2024

this is awesome you could probably add it to https://github.com/api-platform/docs/blob/3.3/core/openapi.md ?

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

No branches or pull requests

2 participants