Skip to content

Commit a416994

Browse files
committed
typed capabilities
1 parent 527a676 commit a416994

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from pydantic import BaseModel
2+
3+
4+
class CapabilitiesResponse(BaseModel):
5+
"""Capabilities of the manifest server."""
6+
7+
custom_code_execution: bool

airbyte_cdk/manifest_server/openapi.yaml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ paths:
4141
content:
4242
application/json:
4343
schema:
44-
type: object
45-
title: Response Getcapabilities
44+
$ref: '#/components/schemas/CapabilitiesResponse'
4645
/v1/manifest/test_read:
4746
post:
4847
tags:
@@ -280,6 +279,16 @@ components:
280279
- response
281280
title: AuxiliaryRequest
282281
description: Auxiliary HTTP request made during stream processing.
282+
CapabilitiesResponse:
283+
properties:
284+
custom_code_execution:
285+
type: boolean
286+
title: Custom Code Execution
287+
type: object
288+
required:
289+
- custom_code_execution
290+
title: CapabilitiesResponse
291+
description: Capabilities of the manifest server.
283292
CheckRequest:
284293
properties:
285294
manifest:

airbyte_cdk/manifest_server/routers/capabilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,16 @@
33

44
from fastapi import APIRouter
55

6+
from ..api_models.capabilities import CapabilitiesResponse
7+
68
router = APIRouter(
79
prefix="/capabilities",
810
tags=["capabilities"],
911
)
1012

1113

1214
@router.get("/", operation_id="getCapabilities")
13-
def get_capabilities() -> Dict[str, Any]:
15+
def get_capabilities() -> CapabilitiesResponse:
1416
"""
1517
Get the capabilities available for the manifest server.
1618
@@ -20,4 +22,4 @@ def get_capabilities() -> Dict[str, Any]:
2022
# Read the same environment variable as the connector builder server
2123
enable_unsafe_code = os.getenv("AIRBYTE_ENABLE_UNSAFE_CODE", "false").lower() == "true"
2224

23-
return {"customCodeExecution": enable_unsafe_code}
25+
return CapabilitiesResponse(custom_code_execution=enable_unsafe_code)

0 commit comments

Comments
 (0)