Skip to content

Commit

Permalink
chore(openapi): use typescript generator w/ fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
gfortaine committed Jan 17, 2023
1 parent 5b2ca28 commit 7314121
Show file tree
Hide file tree
Showing 16 changed files with 1,640 additions and 487 deletions.
10 changes: 10 additions & 0 deletions config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
additionalProperties:
npmName: "@fortaine/openai"
npmVersion: "4.0.0"
supportsES6: true
extensionForDeno: .js
platform: node
files:
logger.mustache:
templateType: SupportingFiles
destinationFilename: logger.ts
8 changes: 8 additions & 0 deletions openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3124,6 +3124,14 @@ components:
- created_at
- level
- message
securitySchemes:
apiKeyAuth:
type: http
scheme: bearer
bearerFormat: JWT

security:
- apiKeyAuth: []

x-oaiMeta:
groups:
Expand Down
8 changes: 6 additions & 2 deletions scripts/generate_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,14 @@ def generate_sanitized_spec(sanitized_spec_path):
def generate_sdk(sanitized_spec_path, sdk_type, output_path):
"""Use openapi-generator to generate the SDK."""
if sdk_type == "node":
sanitized_spec_path = sanitized_spec_path.replace(" ", "\\ ")
output_path = output_path.replace(" ", "\\ ")
template_override_path = os.path.join(os.path.dirname(
__file__), "../sdk-template-overrides/typescript-axios")
__file__), "../sdk-template-overrides/typescript").replace(" ", "\\ ")
configuration_path = os.path.join(os.path.dirname(
__file__), "../config.yaml").replace(" ", "\\ ")
os.system(
f"openapi-generator generate -i {sanitized_spec_path} -g typescript-axios -o {output_path} -p supportsES6=true -t {template_override_path}")
f"openapi-generator generate -i {sanitized_spec_path} -g typescript -o {output_path} -t {template_override_path} -c {configuration_path}")
else:
print(f"Unsupported SDK type {sdk_type}, skipping SDK generation")

Expand Down
364 changes: 0 additions & 364 deletions sdk-template-overrides/typescript-axios/apiInner.mustache

This file was deleted.

121 changes: 0 additions & 121 deletions sdk-template-overrides/typescript-axios/configuration.mustache

This file was deleted.

Loading

0 comments on commit 7314121

Please sign in to comment.