-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(feat): add
format
to the x-fern-streaming
extension to support s…
…se (#3407)
- Loading branch information
Showing
22 changed files
with
263 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
.../cli/openapi-ir-to-fern/src/__test__/__snapshots__/x-fern-streaming-with-sse.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`x-fern-streaming-with-sse x-fern-streaming-with-sse simple 1`] = ` | ||
{ | ||
"definitionFiles": { | ||
"chatCompletions.yml": { | ||
"service": { | ||
"auth": false, | ||
"base-path": "", | ||
"endpoints": { | ||
"create": { | ||
"auth": false, | ||
"docs": undefined, | ||
"method": "POST", | ||
"path": "/completions/chat", | ||
"request": { | ||
"body": { | ||
"properties": { | ||
"prompt": "string", | ||
"stream": "optional<boolean>", | ||
}, | ||
}, | ||
"headers": undefined, | ||
"name": "CreateCompletionRequest", | ||
"query-parameters": undefined, | ||
}, | ||
"response-stream": { | ||
"docs": "Success!", | ||
"format": "sse", | ||
"type": "string", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
"packageMarkerFile": { | ||
"types": { | ||
"Completion": { | ||
"docs": undefined, | ||
"properties": { | ||
"text": "optional<string>", | ||
}, | ||
}, | ||
"CompletionChunk": { | ||
"docs": undefined, | ||
"properties": { | ||
"text": "optional<string>", | ||
}, | ||
}, | ||
}, | ||
}, | ||
"rootApiFile": { | ||
"display-name": "Test extension \`x-fern-audiences\` alongside \`x-fern-streaming\`.", | ||
"error-discrimination": { | ||
"strategy": "status-code", | ||
}, | ||
"name": "api", | ||
}, | ||
} | ||
`; |
49 changes: 49 additions & 0 deletions
49
packages/cli/openapi-ir-to-fern/src/__test__/fixtures/x-fern-streaming-with-sse/openapi.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: Test extension `x-fern-audiences` alongside `x-fern-streaming`. | ||
version: 1.0.0 | ||
paths: | ||
"/completions/chat": | ||
post: | ||
x-fern-sdk-group-name: chatCompletions | ||
x-fern-sdk-method-name: create | ||
x-fern-streaming: | ||
format: sse | ||
# stream-condition: $request.stream | ||
# response: | ||
# $ref: "#/components/schemas/Completion" | ||
# response-stream: | ||
# $ref: "#/components/schemas/CompletionChunk" | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
$ref: "#/components/schemas/CreateCompletionRequest" | ||
responses: | ||
"200": | ||
description: "Success!" | ||
content: | ||
application/json: | ||
schema: | ||
type: string | ||
components: | ||
schemas: | ||
CreateCompletionRequest: | ||
type: object | ||
properties: | ||
stream: | ||
type: boolean | ||
prompt: | ||
type: string | ||
required: | ||
- prompt | ||
Completion: | ||
type: object | ||
properties: | ||
text: | ||
type: string | ||
CompletionChunk: | ||
type: object | ||
properties: | ||
text: | ||
type: string |
5 changes: 5 additions & 0 deletions
5
packages/cli/openapi-ir-to-fern/src/__test__/x-fern-streaming-with-sse.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { testConvertOpenAPI } from "./testConvertOpenApi"; | ||
|
||
describe("x-fern-streaming-with-sse", () => { | ||
testConvertOpenAPI("x-fern-streaming-with-sse", "openapi.yml"); | ||
}); |
Oops, something went wrong.