This repository was archived by the owner on Jun 5, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +15
-20
lines changed
Expand file tree Collapse file tree 3 files changed +15
-20
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ build-backend = "poetry.core.masonry.api"
5050
5151[tool .poetry .scripts ]
5252codegate = " codegate.cli:main"
53- generate-openapi = " src.codegate.dashboard.dashboard :generate_openapi"
53+ generate-openapi = " src.codegate.server :generate_openapi"
5454
5555[tool .black ]
5656line-length = 100
Original file line number Diff line number Diff line change 11import asyncio
2- import json
32from typing import AsyncGenerator , List , Optional
43
54import requests
65import structlog
7- from fastapi import APIRouter , Depends , FastAPI
6+ from fastapi import APIRouter , Depends
87from fastapi .responses import StreamingResponse
98
109from codegate import __version__
11- from codegate .api .v1 import v1
1210from codegate .dashboard .post_processing import (
1311 parse_get_alert_conversation ,
1412 parse_messages_in_conversations ,
@@ -107,19 +105,3 @@ def version_check():
107105 "is_latest" : None ,
108106 "error" : "An unexpected error occurred" ,
109107 }
110-
111-
112- def generate_openapi ():
113- # Create a temporary FastAPI app instance
114- app = FastAPI ()
115-
116- # Include your defined router
117- app .include_router (dashboard_router )
118- app .include_router (v1 , prefix = "/api/v1" , tags = ["CodeGate API" ])
119-
120- # Generate OpenAPI JSON
121- openapi_schema = app .openapi ()
122-
123- # Convert the schema to JSON string for easier handling or storage
124- openapi_json = json .dumps (openapi_schema , indent = 2 )
125- print (openapi_json )
Original file line number Diff line number Diff line change 1+ import json
12import traceback
23
34import structlog
@@ -102,3 +103,15 @@ async def health_check():
102103 app .include_router (v1 , prefix = "/api/v1" , tags = ["CodeGate API" ])
103104
104105 return app
106+
107+
108+ def generate_openapi ():
109+ # Create a temporary FastAPI app instance
110+ app = init_app (None )
111+
112+ # Generate OpenAPI JSON
113+ openapi_schema = app .openapi ()
114+
115+ # Convert the schema to JSON string for easier handling or storage
116+ openapi_json = json .dumps (openapi_schema , indent = 2 )
117+ print (openapi_json )
You can’t perform that action at this time.
0 commit comments