Skip to content

Commit

Permalink
Merge pull request #3271 from centerofci/3270-add-openapi-specificati…
Browse files Browse the repository at this point in the history
…on-for-database_roles-endpoint

Generated OpenAPI specification for `database_roles` endpoint
  • Loading branch information
silentninja authored Oct 31, 2023
2 parents dcedbe6 + b103d3d commit 8b5d433
Show file tree
Hide file tree
Showing 2 changed files with 1,740 additions and 375 deletions.
17 changes: 12 additions & 5 deletions config/settings/openapi.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
def custom_preprocessing_hook(endpoints):
filtered = []
for (path, path_regex, method, callback) in endpoints:
# Remove all but DRF API endpoints
if path.startswith("/api/db/v0/databases/") or path.startswith("/api/db/v0/data_files/") or path.startswith("/api/db/v0/schemas/") or path.startswith("/api/db/v0/tables/"):
filtered.append((path, path_regex, method, callback))
prefixes = [
"/api/db/v0/databases/",
"/api/db/v0/data_files/",
"/api/db/v0/schemas/",
"/api/db/v0/tables/",
"/api/db/v0/links/",
"/api/db/v0/queries/",
"/api/ui/v0/databases/",
"/api/ui/v0/users/",
"/api/ui/v0/database_roles/"
]
filtered = [(path, path_regex, method, callback) for path, path_regex, method, callback in endpoints if any(path.startswith(prefix) for prefix in prefixes)]
return filtered


Expand Down
Loading

0 comments on commit 8b5d433

Please sign in to comment.