Skip to content

Commit 6e264bc

Browse files
committed
fix tipo, make the /api and /api/ endpoint definition cleaner
1 parent 6f55f8e commit 6e264bc

File tree

3 files changed

+4
-33
lines changed

3 files changed

+4
-33
lines changed

src/server/main.py

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -105,43 +105,14 @@ async def custom_swagger_ui(request: Request) -> HTMLResponse:
105105

106106

107107
@app.get("/api", include_in_schema=True)
108-
@app.get("/api/", include_in_schema=False)
109108
def openapi_json_get() -> JSONResponse:
110109
"""Return the OpenAPI schema (openapi.json)."""
111110
return JSONResponse(app.openapi())
112111

113112

114-
@app.post("/api", include_in_schema=False)
115-
@app.post("/api/", include_in_schema=False)
116-
def openapi_json_post() -> JSONResponse:
117-
"""Return the OpenAPI schema (openapi.json)."""
118-
return JSONResponse(app.openapi())
119-
120-
121-
@app.put("/api", include_in_schema=False)
122-
@app.put("/api/", include_in_schema=False)
123-
def openapi_json_put() -> JSONResponse:
124-
"""Return the OpenAPI schema (openapi.json)."""
125-
return JSONResponse(app.openapi())
126-
127-
128-
@app.delete("/api", include_in_schema=False)
129-
@app.delete("/api/", include_in_schema=False)
130-
def openapi_json_delete() -> JSONResponse:
131-
"""Return the OpenAPI schema (openapi.json)."""
132-
return JSONResponse(app.openapi())
133-
134-
135-
@app.options("/api", include_in_schema=False)
136-
@app.options("/api/", include_in_schema=False)
137-
def openapi_json_options() -> JSONResponse:
138-
"""Return the OpenAPI schema (openapi.json)."""
139-
return JSONResponse(app.openapi())
140-
141-
142-
@app.head("/api", include_in_schema=False)
143-
@app.head("/api/", include_in_schema=False)
144-
def openapi_json_head() -> JSONResponse:
113+
@app.api_route("/api", methods=["POST", "PUT", "DELETE", "OPTIONS", "HEAD"], include_in_schema=False)
114+
@app.api_route("/api/", methods=["GET", "POST", "PUT", "DELETE", "OPTIONS", "HEAD"], include_in_schema=False)
115+
def openapi_json() -> JSONResponse:
145116
"""Return the OpenAPI schema (openapi.json)."""
146117
return JSONResponse(app.openapi())
147118

src/server/routers/ingest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
from gitingest.config import TMP_BASE_PATH
77
from server.models import IngestRequest
8-
from server.routers_uitls import COMMON_INGEST_RESPONSES, _perform_ingestion
8+
from server.routers_utils import COMMON_INGEST_RESPONSES, _perform_ingestion
99
from server.server_config import MAX_DISPLAY_SIZE
1010
from server.server_utils import limiter
1111

0 commit comments

Comments
 (0)