MCPcopy Create free account
hub / github.com/OpenHands/OpenHands / generate_openapi_spec

Function generate_openapi_spec

scripts/update_openapi.py:128–148  ·  view source on GitHub ↗

Generate the OpenAPI specification from the FastAPI app.

()

Source from the content-addressed store, hash-verified

126
127
128def generate_openapi_spec():
129 """Generate the OpenAPI specification from the FastAPI app."""
130 spec = app.openapi()
131
132 # Explicitly exclude certain endpoints that are operational or UI-only convenience
133 excluded_endpoints = [
134 '/server_info', # Operational/system diagnostics
135 '/api/conversations/{conversation_id}/vscode-url', # UI/runtime convenience
136 '/api/conversations/{conversation_id}/web-hosts', # UI/runtime convenience
137 ]
138
139 if 'paths' in spec:
140 for endpoint in excluded_endpoints:
141 if endpoint in spec['paths']:
142 del spec['paths'][endpoint]
143 print(f'Excluded endpoint: {endpoint}')
144
145 # Sanitize descriptions and summaries
146 spec = _sanitize_spec(spec)
147
148 return spec
149
150
151def load_current_spec(spec_path):

Callers 1

update_openapi_specFunction · 0.85

Calls 1

_sanitize_specFunction · 0.85

Tested by

no test coverage detected