Skip to content

Commit b62cc95

Browse files
committed
chore(openapi): use typescript generator w/ fetch
1 parent 5b2ca28 commit b62cc95

17 files changed

+1716
-487
lines changed

config.yaml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
additionalProperties:
2+
npmName: "@fortaine/openai"
3+
npmVersion: "4.0.0"
4+
supportsES6: true
5+
extensionForDeno: .js
6+
platform: node
7+
files:
8+
logger.mustache:
9+
templateType: SupportingFiles
10+
destinationFilename: logger.ts

openapi.yaml

+8
Original file line numberDiff line numberDiff line change
@@ -3124,6 +3124,14 @@ components:
31243124
- created_at
31253125
- level
31263126
- message
3127+
securitySchemes:
3128+
apiKeyAuth:
3129+
type: http
3130+
scheme: bearer
3131+
bearerFormat: JWT
3132+
3133+
security:
3134+
- apiKeyAuth: []
31273135

31283136
x-oaiMeta:
31293137
groups:

scripts/generate_sdk.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,14 @@ def generate_sanitized_spec(sanitized_spec_path):
8484
def generate_sdk(sanitized_spec_path, sdk_type, output_path):
8585
"""Use openapi-generator to generate the SDK."""
8686
if sdk_type == "node":
87+
sanitized_spec_path = sanitized_spec_path.replace(" ", "\\ ")
88+
output_path = output_path.replace(" ", "\\ ")
8789
template_override_path = os.path.join(os.path.dirname(
88-
__file__), "../sdk-template-overrides/typescript-axios")
90+
__file__), "../sdk-template-overrides/typescript").replace(" ", "\\ ")
91+
configuration_path = os.path.join(os.path.dirname(
92+
__file__), "../config.yaml").replace(" ", "\\ ")
8993
os.system(
90-
f"openapi-generator generate -i {sanitized_spec_path} -g typescript-axios -o {output_path} -p supportsES6=true -t {template_override_path}")
94+
f"openapi-generator generate -i {sanitized_spec_path} -g typescript -o {output_path} -t {template_override_path} -c {configuration_path}")
9195
else:
9296
print(f"Unsupported SDK type {sdk_type}, skipping SDK generation")
9397

sdk-template-overrides/typescript-axios/apiInner.mustache

-364
This file was deleted.

sdk-template-overrides/typescript-axios/configuration.mustache

-121
This file was deleted.

0 commit comments

Comments
 (0)