From eff31d23aaa180caee48d55e056c3ca703b41c55 Mon Sep 17 00:00:00 2001 From: Deep Singhvi Date: Sun, 15 Dec 2024 19:02:56 -0500 Subject: [PATCH] fix(cli): generated sse examples must have a data and `event` key (#5421) --- .../v3/converters/ExampleEndpointFactory.ts | 16 ++++++++-- .../openapi-docs/switchboard.json | 29 +++++++++++-------- .../x-fern-streaming-with-sse.json | 8 +++-- .../__snapshots__/openapi-ir/streaming.json | 9 ++++-- .../__snapshots__/openapi-ir/switchboard.json | 3 +- .../__snapshots__/openapi-ir/vellum.json | 6 ++-- .../openapi-ir/x-fern-global-headers.json | 3 +- .../x-fern-sdk-group-name-with-streaming.json | 3 +- .../x-fern-streaming-with-audiences.json | 3 +- .../x-fern-streaming-with-reference.json | 3 +- .../openapi-ir/x-fern-streaming-with-sse.json | 3 +- ...-fern-streaming-with-stream-condition.json | 3 +- .../__snapshots__/openapi/switchboard.json | 29 +++++++++++-------- .../openapi/x-fern-streaming-with-sse.json | 8 +++-- .../src/utils/convertFullExample.ts | 21 +++++++++++--- .../openapi-ir/fern/definition/finalIr.yml | 7 ++++- .../finalIr/types/EndpointResponseExample.ts | 13 +++++---- .../finalIr/types/StreamingResponseExample.ts | 10 +++++++ .../sdk/api/resources/finalIr/types/index.ts | 1 + .../finalIr/types/EndpointResponseExample.ts | 10 +++---- .../finalIr/types/StreamingResponseExample.ts | 22 ++++++++++++++ .../resources/finalIr/types/index.ts | 1 + packages/cli/cli/versions.yml | 7 +++++ 23 files changed, 159 insertions(+), 59 deletions(-) create mode 100644 packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/StreamingResponseExample.ts create mode 100644 packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/StreamingResponseExample.ts diff --git a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts b/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts index 6316dfe8985..02f6926913f 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts +++ b/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts @@ -115,7 +115,13 @@ export class ExampleEndpointFactory { endpoint.response?.type === "streamingJson" || endpoint.response?.type === "streamingSse" ) { - responseExamples.push([undefined, EndpointResponseExample.withStreaming([example])]); + responseExamples.push([ + undefined, + EndpointResponseExample.withStreaming({ + sse: endpoint.response?.type === "streamingSse", + events: [example] + }) + ]); } } } else { @@ -138,7 +144,13 @@ export class ExampleEndpointFactory { endpoint.response?.type === "streamingJson" || endpoint.response?.type === "streamingSse" ) { - responseExamples.push([exampleId, EndpointResponseExample.withStreaming([example])]); + responseExamples.push([ + undefined, + EndpointResponseExample.withStreaming({ + sse: endpoint.response?.type === "streamingSse", + events: [example] + }) + ]); } } } diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/switchboard.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/switchboard.json index 72baea8c09d..17f14de6f23 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/switchboard.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/switchboard.json @@ -2110,13 +2110,16 @@ service: "stream": [ { "data": { - "code": "code", - "event": "event", - "message": "message", + "data": { + "code": "code", + "event": "event", + "message": "message", + }, + "event": "error", + "id": 1, + "retry": 1, }, - "event": "error", - "id": 1, - "retry": 1, + "event": "", }, ], }, @@ -2797,13 +2800,15 @@ service: id: 6aac6f73-bd89-4a76-ab32-5a6c422e8b0b response: stream: - - event: error + - event: '' data: - code: code - event: event - message: message - id: 1 - retry: 1 + event: error + data: + code: code + event: event + message: message + id: 1 + retry: 1 audiences: - public source: diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/x-fern-streaming-with-sse.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/x-fern-streaming-with-sse.json index 437e6f6ba86..b2ac5338757 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/x-fern-streaming-with-sse.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/x-fern-streaming-with-sse.json @@ -58,7 +58,10 @@ }, "response": { "stream": [ - "string", + { + "data": "string", + "event": "", + }, ], }, }, @@ -120,7 +123,8 @@ prompt: prompt response: stream: - - string + - event: '' + data: string source: openapi: ../openapi.yml ", diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/streaming.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/streaming.json index cb6087cf565..3f28c4d651a 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/streaming.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/streaming.json @@ -114,7 +114,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { @@ -378,7 +379,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { @@ -734,7 +736,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/switchboard.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/switchboard.json index c996cdd3971..d7f0b2b16d6 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/switchboard.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/switchboard.json @@ -3333,7 +3333,8 @@ "queryParameters": [], "headers": [], "response": { - "value": [ + "sse": true, + "events": [ { "value": { "value": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/vellum.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/vellum.json index 1a6d2e09c3c..5a30d627abe 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/vellum.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/vellum.json @@ -1309,7 +1309,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "value": { "value": { @@ -2007,7 +2008,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "delta": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-global-headers.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-global-headers.json index 85d9ca1a923..325bb7924b7 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-global-headers.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-global-headers.json @@ -239,7 +239,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-sdk-group-name-with-streaming.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-sdk-group-name-with-streaming.json index a960c0caa25..9fb86132885 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-sdk-group-name-with-streaming.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-sdk-group-name-with-streaming.json @@ -127,7 +127,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-audiences.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-audiences.json index 45ede079644..16484045178 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-audiences.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-audiences.json @@ -129,7 +129,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "id": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-reference.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-reference.json index 74dc48e8dfd..5171ad47049 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-reference.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-reference.json @@ -120,7 +120,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "text": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-sse.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-sse.json index 7eaf9776ef7..c04dcaa1f05 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-sse.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-sse.json @@ -78,7 +78,8 @@ "type": "object" }, "response": { - "value": [ + "sse": true, + "events": [ { "value": { "value": "string", diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-stream-condition.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-stream-condition.json index a438f6654b9..cddba3bc65b 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-stream-condition.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/x-fern-streaming-with-stream-condition.json @@ -175,7 +175,8 @@ "type": "object" }, "response": { - "value": [ + "sse": false, + "events": [ { "properties": { "chunk": { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/switchboard.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/switchboard.json index 5908573f6e9..70b100ebd8c 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/switchboard.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/switchboard.json @@ -2002,13 +2002,16 @@ service: "stream": [ { "data": { - "code": "code", - "event": "event", - "message": "message", + "data": { + "code": "code", + "event": "event", + "message": "message", + }, + "event": "error", + "id": 1, + "retry": 1, }, - "event": "error", - "id": 1, - "retry": 1, + "event": "", }, ], }, @@ -2689,13 +2692,15 @@ service: id: 6aac6f73-bd89-4a76-ab32-5a6c422e8b0b response: stream: - - event: error + - event: '' data: - code: code - event: event - message: message - id: 1 - retry: 1 + event: error + data: + code: code + event: event + message: message + id: 1 + retry: 1 audiences: - public source: diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/x-fern-streaming-with-sse.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/x-fern-streaming-with-sse.json index 437e6f6ba86..b2ac5338757 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/x-fern-streaming-with-sse.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/x-fern-streaming-with-sse.json @@ -58,7 +58,10 @@ }, "response": { "stream": [ - "string", + { + "data": "string", + "event": "", + }, ], }, }, @@ -120,7 +123,8 @@ prompt: prompt response: stream: - - string + - event: '' + data: string source: openapi: ../openapi.yml ", diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern/src/utils/convertFullExample.ts b/packages/cli/api-importers/openapi/openapi-ir-to-fern/src/utils/convertFullExample.ts index 941e1562066..b9953934f5e 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern/src/utils/convertFullExample.ts +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern/src/utils/convertFullExample.ts @@ -36,10 +36,17 @@ export function convertEndpointResponseExample( endpointResponseExample: EndpointResponseExample ): RawSchemas.ExampleStreamResponseSchema | RawSchemas.ExampleBodyResponseSchema { switch (endpointResponseExample.type) { - case "withStreaming": - return { - stream: convertArrayExample(endpointResponseExample.value) - }; + case "withStreaming": { + if (endpointResponseExample.sse) { + return { + stream: convertSseExample(endpointResponseExample.events) + }; + } else { + return { + stream: convertArrayExample(endpointResponseExample.events) + }; + } + } case "withoutStreaming": return { body: convertFullExample(endpointResponseExample.value) @@ -97,6 +104,12 @@ function convertObject(object: Record): RawSchemas.Exa ); } +function convertSseExample(fullExamples: FullExample[]): RawSchemas.ExampleSseEventSchema[] { + return fullExamples.map((fullExample) => { + return { event: "", data: convertFullExample(fullExample) }; + }); +} + function convertArrayExample(fullExamples: FullExample[]): RawSchemas.ExampleTypeReferenceSchema[] { return fullExamples.map((fullExample) => { return convertFullExample(fullExample); diff --git a/packages/cli/api-importers/openapi/openapi-ir/fern/definition/finalIr.yml b/packages/cli/api-importers/openapi/openapi-ir/fern/definition/finalIr.yml index 2aed07940f3..90ff933c8ef 100644 --- a/packages/cli/api-importers/openapi/openapi-ir/fern/definition/finalIr.yml +++ b/packages/cli/api-importers/openapi/openapi-ir/fern/definition/finalIr.yml @@ -295,8 +295,13 @@ types: EndpointResponseExample: docs: An example that has either a list of streaming examples or a single non-streaming example. union: - withStreaming: list + withStreaming: StreamingResponseExample withoutStreaming: example.FullExample + + StreamingResponseExample: + properties: + sse: boolean + events: list PathParameterExample: properties: diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/EndpointResponseExample.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/EndpointResponseExample.ts index ed270886849..728a44732d0 100644 --- a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/EndpointResponseExample.ts +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/EndpointResponseExample.ts @@ -12,9 +12,8 @@ export type EndpointResponseExample = | FernOpenapiIr.EndpointResponseExample.WithoutStreaming; export declare namespace EndpointResponseExample { - interface WithStreaming extends _Utils { + interface WithStreaming extends FernOpenapiIr.StreamingResponseExample, _Utils { type: "withStreaming"; - value: FernOpenapiIr.FullExample[]; } interface WithoutStreaming extends _Utils { @@ -27,16 +26,18 @@ export declare namespace EndpointResponseExample { } interface _Visitor<_Result> { - withStreaming: (value: FernOpenapiIr.FullExample[]) => _Result; + withStreaming: (value: FernOpenapiIr.StreamingResponseExample) => _Result; withoutStreaming: (value: FernOpenapiIr.FullExample) => _Result; _other: (value: { type: string }) => _Result; } } export const EndpointResponseExample = { - withStreaming: (value: FernOpenapiIr.FullExample[]): FernOpenapiIr.EndpointResponseExample.WithStreaming => { + withStreaming: ( + value: FernOpenapiIr.StreamingResponseExample + ): FernOpenapiIr.EndpointResponseExample.WithStreaming => { return { - value: value, + ...value, type: "withStreaming", _visit: function <_Result>( this: FernOpenapiIr.EndpointResponseExample.WithStreaming, @@ -66,7 +67,7 @@ export const EndpointResponseExample = { ): _Result => { switch (value.type) { case "withStreaming": - return visitor.withStreaming(value.value); + return visitor.withStreaming(value); case "withoutStreaming": return visitor.withoutStreaming(value.value); default: diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/StreamingResponseExample.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/StreamingResponseExample.ts new file mode 100644 index 00000000000..475bab284d1 --- /dev/null +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/StreamingResponseExample.ts @@ -0,0 +1,10 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as FernOpenapiIr from "../../../index"; + +export interface StreamingResponseExample { + sse: boolean; + events: FernOpenapiIr.FullExample[]; +} diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/index.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/index.ts index 072b21b09fc..cdc01b80c68 100644 --- a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/index.ts +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/api/resources/finalIr/types/index.ts @@ -26,6 +26,7 @@ export * from "./FernExample"; export * from "./EndpointExample"; export * from "./FullEndpointExample"; export * from "./EndpointResponseExample"; +export * from "./StreamingResponseExample"; export * from "./PathParameterExample"; export * from "./QueryParameterExample"; export * from "./HeaderExample"; diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/EndpointResponseExample.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/EndpointResponseExample.ts index 3f12ed61508..495d9656273 100644 --- a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/EndpointResponseExample.ts +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/EndpointResponseExample.ts @@ -5,15 +5,14 @@ import * as serializers from "../../../index"; import * as FernOpenapiIr from "../../../../api/index"; import * as core from "../../../../core"; +import { StreamingResponseExample } from "./StreamingResponseExample"; export const EndpointResponseExample: core.serialization.Schema< serializers.EndpointResponseExample.Raw, FernOpenapiIr.EndpointResponseExample > = core.serialization .union("type", { - withStreaming: core.serialization.object({ - value: core.serialization.list(core.serialization.lazy(() => serializers.FullExample)), - }), + withStreaming: StreamingResponseExample, withoutStreaming: core.serialization.object({ value: core.serialization.lazy(() => serializers.FullExample), }), @@ -22,7 +21,7 @@ export const EndpointResponseExample: core.serialization.Schema< transform: (value) => { switch (value.type) { case "withStreaming": - return FernOpenapiIr.EndpointResponseExample.withStreaming(value.value); + return FernOpenapiIr.EndpointResponseExample.withStreaming(value); case "withoutStreaming": return FernOpenapiIr.EndpointResponseExample.withoutStreaming(value.value); default: @@ -35,9 +34,8 @@ export const EndpointResponseExample: core.serialization.Schema< export declare namespace EndpointResponseExample { type Raw = EndpointResponseExample.WithStreaming | EndpointResponseExample.WithoutStreaming; - interface WithStreaming { + interface WithStreaming extends StreamingResponseExample.Raw { type: "withStreaming"; - value: serializers.FullExample.Raw[]; } interface WithoutStreaming { diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/StreamingResponseExample.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/StreamingResponseExample.ts new file mode 100644 index 00000000000..a3d878c777f --- /dev/null +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/StreamingResponseExample.ts @@ -0,0 +1,22 @@ +/** + * This file was auto-generated by Fern from our API Definition. + */ + +import * as serializers from "../../../index"; +import * as FernOpenapiIr from "../../../../api/index"; +import * as core from "../../../../core"; + +export const StreamingResponseExample: core.serialization.ObjectSchema< + serializers.StreamingResponseExample.Raw, + FernOpenapiIr.StreamingResponseExample +> = core.serialization.objectWithoutOptionalProperties({ + sse: core.serialization.boolean(), + events: core.serialization.list(core.serialization.lazy(() => serializers.FullExample)), +}); + +export declare namespace StreamingResponseExample { + interface Raw { + sse: boolean; + events: serializers.FullExample.Raw[]; + } +} diff --git a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/index.ts b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/index.ts index 072b21b09fc..cdc01b80c68 100644 --- a/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/index.ts +++ b/packages/cli/api-importers/openapi/openapi-ir/src/sdk/serialization/resources/finalIr/types/index.ts @@ -26,6 +26,7 @@ export * from "./FernExample"; export * from "./EndpointExample"; export * from "./FullEndpointExample"; export * from "./EndpointResponseExample"; +export * from "./StreamingResponseExample"; export * from "./PathParameterExample"; export * from "./QueryParameterExample"; export * from "./HeaderExample"; diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index 64db9050dcc..40f9ac02b9e 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,3 +1,10 @@ +- changelogEntry: + - summary: | + The generated SSE examples always have `data` and `event` keys so that they are correct. + type: fix + irVersion: 53 + version: 0.46.4 + - changelogEntry: - summary: | The Fern CLI now supports generating examples for streaming SSE (server-sent-event)