Skip to content

Commit 083b9ff

Browse files
committed
feat: Add minimal openapi transformer
1 parent 618541a commit 083b9ff

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from typing import Dict, List
2+
import pyarrow as pa
3+
from cloudquery.sdk.schema import Column
4+
5+
def oapi_type_to_arrow_type(field) -> pa.DataType:
6+
oapi_type = field.get("type")
7+
if oapi_type == "string":
8+
return pa.string()
9+
elif oapi_type == "number":
10+
return pa.int64()
11+
elif oapi_type == "boolean":
12+
return pa.bool_()
13+
else:
14+
return pa.string()
15+
16+
def oapi_properties_to_columns(properties: Dict) -> List[Column]:
17+
columns = []
18+
for key, value in properties.items():
19+
columns.append(Column(name=key, type=value, description=value.get("description")))
20+
return columns

0 commit comments

Comments
 (0)