Skip to content

Commit

Permalink
Added Scalar API explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
danyi1212 committed Dec 11, 2024
1 parent 25c0d84 commit 4e2542c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions horizon/factdb/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
HttpFetcherConfig,
HttpMethods,
)
from scalar_fastapi import get_scalar_api_reference
from starlette import status
from starlette.responses import JSONResponse

Expand Down Expand Up @@ -51,6 +52,13 @@ def _init_fast_api_app(self) -> FastAPI:
def _configure_api_routes(self, app: FastAPI):
"""mounts the api routes on the app object."""

@app.get("/scalar", include_in_schema=False)
async def scalar_html():
return get_scalar_api_reference(
openapi_url="/openapi.json",
title="Permit.io PDP API",
)

authenticator = JWTAuthenticator(self.verifier)

# Init api routers with required dependencies
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ uvicorn[standard]>=0.17.6,<1
logzio-python-handler
ddtrace
sqlparse==0.5.0
scalar-fastapi==1.0.3
httpx>=0.27.0,<1
protobuf>=3.20.2 # not directly required, pinned by Snyk to avoid a vulnerability
opal-common==0.7.15
Expand Down

0 comments on commit 4e2542c

Please sign in to comment.