From d34c3d22edbb19af4ed3dc64f8e1b677f34ed519 Mon Sep 17 00:00:00 2001 From: "adi.david" Date: Thu, 25 Jun 2026 18:03:44 +0000 Subject: [PATCH 1/4] feat: extract per-content-type examples in OAS importer When an OpenAPI operation declares multiple content types (e.g. application/json and application/ld+json) with distinct per-mediaType examples, the importer now elevates those body-level examples into endpoint-level v2Examples tagged with their content type. Changes: - Add optional contentType field to V2HttpEndpointExample (IR v67.7.0) - Implement synthesizeEndpointExamplesFromPerContentTypeRequestBodies() in OperationConverter.ts - Add extractNativeResponseExamplesByContentType() helper to pair response examples with the correct content type - Add test fixture: multi-content-type-examples This enables the docs UI to display the correct example body when the user switches content types in the playground/API reference. Resolves: FER-11417 Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../paths/operations/OperationConverter.ts | 148 ++++++++++++++++++ .../src/1.x/methods/MethodConverter.ts | 1 + .../unreleased/per-content-type-examples.yml | 7 + .../utils/InitializeEmptyServiceExample.ts | 1 + .../examples/v2/generateEndpointExample.ts | 1 + .../ir-sdk/fern/apis/ir-types-latest/VERSION | 2 +- .../ir-types-latest/changelog/CHANGELOG.md | 7 + .../ir-types-latest/definition/examples.yml | 6 + .../examples/types/V2HttpEndpointExample.ts | 6 + .../examples/types/V2HttpEndpointExample.ts | 2 + .../generators.yml | 5 + .../multi-content-type-examples/openapi.yml | 99 ++++++++++++ 12 files changed, 284 insertions(+), 1 deletion(-) create mode 100644 packages/cli/cli/changes/unreleased/per-content-type-examples.yml create mode 100644 test-definitions/fern/apis/multi-content-type-examples/generators.yml create mode 100644 test-definitions/fern/apis/multi-content-type-examples/openapi.yml diff --git a/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts b/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts index d8b3f6af19b8..2ae7bfe7a752 100644 --- a/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts +++ b/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts @@ -164,6 +164,29 @@ export class OperationConverter extends AbstractOperationConverter { } } + // When there are still no endpoint-level examples but the per-content-type + // request bodies have v2Examples (from native OAS per-mediaType examples on + // bodies WITH schemas), elevate them to endpoint-level examples tagged with + // their content type. This enables docs to display per-content-type examples. + if ( + Object.keys(fernExamples.examples).length === 0 && + Object.keys(fernExamples.streamExamples).length === 0 && + convertedRequestBodies != null && + convertedRequestBodies.length > 0 + ) { + const perContentTypeExamples = this.synthesizeEndpointExamplesFromPerContentTypeRequestBodies({ + convertedRequestBodies, + httpPath: path, + httpMethod, + baseUrl + }); + if (perContentTypeExamples != null) { + for (const [name, example] of Object.entries(perContentTypeExamples)) { + fernExamples.examples[name] = example; + } + } + } + const endpointLevelSecuritySchemes = new Set( this.operation.security?.flatMap((securityRequirement) => Object.keys(securityRequirement)) ?? [] ); @@ -817,6 +840,7 @@ export class OperationConverter extends AbstractOperationConverter { if (resolvedValue != null) { result[name] = { displayName: undefined, + contentType: undefined, request: { docs: undefined, endpoint: { @@ -883,6 +907,129 @@ export class OperationConverter extends AbstractOperationConverter { return undefined; } + /** + * Synthesizes endpoint-level v2Examples from per-content-type request body + * examples that have already been extracted by the RequestBodyConverter. + * + * This handles the case where multiple content types (e.g. application/json + * and application/ld+json) reference the same schema but have distinct + * per-content-type examples. The RequestBodyConverter correctly extracts + * these into each body's v2Examples, but they need to be elevated to + * endpoint-level examples (tagged with contentType) for docs rendering. + */ + private synthesizeEndpointExamplesFromPerContentTypeRequestBodies({ + convertedRequestBodies, + httpPath, + httpMethod, + baseUrl + }: { + convertedRequestBodies: { requestBody: FernIr.HttpRequestBody }[]; + httpPath: HttpPath; + httpMethod: FernIr.HttpMethod; + baseUrl: string | undefined; + }): Record | undefined { + const result: Record = {}; + const responseExamplesByContentType = this.extractNativeResponseExamplesByContentType(); + + for (const convertedBody of convertedRequestBodies) { + const body = convertedBody.requestBody; + const bodyContentType = body.contentType; + const bodyV2Examples = body.v2Examples; + + if (bodyV2Examples == null) { + continue; + } + + const userExamples = bodyV2Examples.userSpecifiedExamples; + if (Object.keys(userExamples).length === 0) { + continue; + } + + // Find a matching response example for this content type + const matchedResponse = + bodyContentType != null ? responseExamplesByContentType.get(bodyContentType) : undefined; + + for (const [exampleName, exampleValue] of Object.entries(userExamples)) { + // Use a unique key that includes the content type to avoid collisions + const key = + convertedRequestBodies.length > 1 && bodyContentType != null + ? `${exampleName} (${bodyContentType})` + : exampleName; + + result[key] = { + displayName: convertedRequestBodies.length > 1 ? key : undefined, + contentType: bodyContentType ?? undefined, + request: { + docs: undefined, + endpoint: { + method: httpMethod, + path: this.buildExamplePath(httpPath, {}) + }, + baseUrl: undefined, + environment: baseUrl, + auth: undefined, + pathParameters: {}, + queryParameters: {}, + headers: {}, + requestBody: exampleValue + }, + response: matchedResponse ?? this.extractNativeResponseExample() ?? undefined, + codeSamples: undefined + }; + } + } + + return Object.keys(result).length > 0 ? result : undefined; + } + + /** + * Extracts native response examples grouped by content type from the + * operation's successful (2xx) responses. Used by + * synthesizeEndpointExamplesFromPerContentTypeRequestBodies to match + * response examples to their corresponding request content types. + */ + private extractNativeResponseExamplesByContentType(): Map { + const responsesByContentType = new Map(); + if (this.operation.responses == null) { + return responsesByContentType; + } + for (const [statusCode, response] of Object.entries(this.operation.responses)) { + const statusCodeNum = parseInt(statusCode); + if (isNaN(statusCodeNum) || statusCodeNum < 200 || statusCodeNum >= 300) { + continue; + } + const resolvedResponse = this.context.resolveMaybeReference({ + schemaOrReference: response, + breadcrumbs: [...this.breadcrumbs, "responses", statusCode] + }); + if (resolvedResponse?.content == null) { + continue; + } + for (const [responseContentType, responseMediaType] of Object.entries(resolvedResponse.content)) { + if (responsesByContentType.has(responseContentType)) { + continue; + } + const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({ + mediaTypeObject: responseMediaType, + breadcrumbs: [...this.breadcrumbs, "responses", statusCode], + defaultExampleName: "Example" + }); + for (const [, example] of namedExamples) { + const resolvedValue = this.context.resolveExampleWithValue(example); + if (resolvedValue != null) { + responsesByContentType.set(responseContentType, { + docs: undefined, + statusCode: statusCodeNum, + body: FernIr.V2HttpEndpointResponseBody.json(resolvedValue) + }); + break; + } + } + } + } + return responsesByContentType; + } + private convertStreamConditionExamples({ httpPath, httpMethod, @@ -935,6 +1082,7 @@ export class OperationConverter extends AbstractOperationConverter { this.getExampleName({ example, exampleIndex }), { displayName: undefined, + contentType: undefined, request: example.request != null || example["path-parameters"] != null || diff --git a/packages/cli/api-importers/openrpc-to-ir/src/1.x/methods/MethodConverter.ts b/packages/cli/api-importers/openrpc-to-ir/src/1.x/methods/MethodConverter.ts index 5c532df2dc27..a589f7b4cdaa 100644 --- a/packages/cli/api-importers/openrpc-to-ir/src/1.x/methods/MethodConverter.ts +++ b/packages/cli/api-importers/openrpc-to-ir/src/1.x/methods/MethodConverter.ts @@ -327,6 +327,7 @@ export class MethodConverter extends AbstractConverter + contentType: + type: optional + docs: | + The content type this example is associated with (e.g. "application/json", + "application/ld+json"). When present, the docs UI can filter or auto-select + this example when the user switches to the corresponding content type. request: optional response: optional codeSamples: optional> diff --git a/packages/ir-sdk/src/sdk/api/resources/examples/types/V2HttpEndpointExample.ts b/packages/ir-sdk/src/sdk/api/resources/examples/types/V2HttpEndpointExample.ts index 63035af5470b..9aca4d328573 100644 --- a/packages/ir-sdk/src/sdk/api/resources/examples/types/V2HttpEndpointExample.ts +++ b/packages/ir-sdk/src/sdk/api/resources/examples/types/V2HttpEndpointExample.ts @@ -4,6 +4,12 @@ import type * as FernIr from "../../../index.js"; export interface V2HttpEndpointExample { displayName: string | undefined; + /** + * The content type this example is associated with (e.g. "application/json", + * "application/ld+json"). When present, the docs UI can filter or auto-select + * this example when the user switches to the corresponding content type. + */ + contentType: string | undefined; request: FernIr.V2HttpEndpointRequest | undefined; response: FernIr.V2HttpEndpointResponse | undefined; codeSamples: FernIr.V2HttpEndpointCodeSample[] | undefined; diff --git a/packages/ir-sdk/src/sdk/serialization/resources/examples/types/V2HttpEndpointExample.ts b/packages/ir-sdk/src/sdk/serialization/resources/examples/types/V2HttpEndpointExample.ts index c7087d22c5ab..4ec445d87d6d 100644 --- a/packages/ir-sdk/src/sdk/serialization/resources/examples/types/V2HttpEndpointExample.ts +++ b/packages/ir-sdk/src/sdk/serialization/resources/examples/types/V2HttpEndpointExample.ts @@ -12,6 +12,7 @@ export const V2HttpEndpointExample: core.serialization.ObjectSchema< FernIr.V2HttpEndpointExample > = core.serialization.objectWithoutOptionalProperties({ displayName: core.serialization.string().optional(), + contentType: core.serialization.string().optional(), request: V2HttpEndpointRequest.optional(), response: V2HttpEndpointResponse.optional(), codeSamples: core.serialization.list(V2HttpEndpointCodeSample).optional(), @@ -20,6 +21,7 @@ export const V2HttpEndpointExample: core.serialization.ObjectSchema< export declare namespace V2HttpEndpointExample { export interface Raw { displayName?: string | null; + contentType?: string | null; request?: V2HttpEndpointRequest.Raw | null; response?: V2HttpEndpointResponse.Raw | null; codeSamples?: V2HttpEndpointCodeSample.Raw[] | null; diff --git a/test-definitions/fern/apis/multi-content-type-examples/generators.yml b/test-definitions/fern/apis/multi-content-type-examples/generators.yml new file mode 100644 index 000000000000..8a83d39a5bac --- /dev/null +++ b/test-definitions/fern/apis/multi-content-type-examples/generators.yml @@ -0,0 +1,5 @@ +# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json +api: + specs: + - openapi: openapi.yml +groups: {} diff --git a/test-definitions/fern/apis/multi-content-type-examples/openapi.yml b/test-definitions/fern/apis/multi-content-type-examples/openapi.yml new file mode 100644 index 000000000000..bb578fe39ac3 --- /dev/null +++ b/test-definitions/fern/apis/multi-content-type-examples/openapi.yml @@ -0,0 +1,99 @@ +openapi: 3.1.0 +info: + title: Multi Content Type Examples + version: 1.0.0 +paths: + /clients: + post: + operationId: clients_create + tags: + - Clients + summary: Create client + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ClientRequest" + examples: + NewClientJson: + summary: Plain JSON client + value: + client: + name: "Acme Corp" + email: "contact@acme.com" + application/ld+json: + schema: + $ref: "#/components/schemas/ClientRequest" + examples: + NewClientJsonLd: + summary: JSON-LD client with linked data context + value: + "@context": "urn:example:governance-model#" + client: + "@type": "Client" + name: "Acme Corp" + email: "contact@acme.com" + responses: + "201": + description: Client created successfully + content: + application/json: + schema: + $ref: "#/components/schemas/ClientResponse" + examples: + CreatedClientJson: + summary: Plain JSON response + value: + client: + id: "client-123" + name: "Acme Corp" + email: "contact@acme.com" + application/ld+json: + schema: + $ref: "#/components/schemas/ClientResponse" + examples: + CreatedClientJsonLd: + summary: JSON-LD response with linked data context + value: + "@context": "urn:example:governance-model#" + client: + "@type": "Client" + id: "client-123" + name: "Acme Corp" + email: "contact@acme.com" +components: + schemas: + ClientRequest: + type: object + properties: + client: + $ref: "#/components/schemas/Client" + ClientResponse: + type: object + properties: + client: + $ref: "#/components/schemas/ClientWithId" + Client: + type: object + properties: + name: + type: string + email: + type: string + required: + - name + - email + ClientWithId: + type: object + properties: + id: + type: string + name: + type: string + email: + type: string + required: + - id + - name + - email From c2ea0e75d34ee63cd2f35ba736c75b12b678b455 Mon Sep 17 00:00:00 2001 From: "adi.david" Date: Thu, 25 Jun 2026 18:31:52 +0000 Subject: [PATCH 2/4] fix(ir): guard per-content-type example synthesis to multi-content-type endpoints only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Change fallback condition from convertedRequestBodies.length > 0 to > 1 so single-content-type endpoints keep using normal v1→v2 example synthesis - Remove debug console.logs from schema-level and response-level tests - Add multi-content-type-examples test fixture and snapshot - Update all affected snapshots (contentType field addition) Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../paths/operations/OperationConverter.ts | 12 +- .../__snapshots__/ai-examples-issue-fdr.snap | 1 + .../__snapshots__/ai-examples-issue-ir.snap | 1 + .../__snapshots__/anyOf-no-titles-ir.snap | 1 + .../__snapshots__/anyOf-titled-ir.snap | 1 + .../__snapshots__/auth-name-collision-ir.snap | 2 + .../auth-scheme-example-selection-ir.snap | 1 + .../auth-scheme-override-ir.snap | 3 + .../auth-user-docs-priority-ir.snap | 1 + .../__snapshots__/auth-with-overrides-ir.snap | 2 + .../autogen-examples-test-ir.snap | 2 + .../__snapshots__/balance-max-null-fdr.snap | 1 + .../__snapshots__/balance-max-null-ir.snap | 1 + .../company-file-ref-examples-ir.snap | 1 + .../explode-parameter-test-ir.snap | 3 + .../__snapshots__/grpc-comments-ir.snap | 1 + .../http-auth-capital-scheme-ir.snap | 2 + .../human-examples-preserved-fdr.snap | 1 + .../human-examples-preserved-ir.snap | 2 + .../__snapshots__/min-max-values-ir.snap | 2 + .../mixed-examples-test-fdr.snap | 1 + .../__snapshots__/mixed-examples-test-ir.snap | 2 + .../multi-content-type-examples-fdr.snap | 519 ++++++++ .../multi-content-type-examples-ir.snap | 1099 +++++++++++++++++ .../multiple-security-headers-ir.snap | 4 + .../__snapshots__/oneOf-discriminator-ir.snap | 1 + .../oneOf-no-discriminator-ir.snap | 1 + .../oneOf-references-mapping-ir.snap | 1 + .../__snapshots__/oneOf-titled-ir.snap | 1 + .../__snapshots__/openapi-auth-test-ir.snap | 2 + .../openapi-example-summary-fdr.snap | 4 + .../openapi-example-summary-ir.snap | 4 + .../openapi-from-flag-simple-ir.snap | 3 + .../openapi-overrides-summary-ir.snap | 4 + .../response-level-example-fdr.snap | 5 + .../response-level-example-ir.snap | 5 + .../response-status-code-examples-ir.snap | 1 + .../schema-level-example-fdr.snap | 4 + .../schema-level-example-ir.snap | 4 + .../throttled-error-response-ir.snap | 1 + .../wildcard-status-conflict-ir.snap | 1 + .../__snapshots__/x-code-samples-ir.snap | 1 + .../x-code-samples-override-fdr.snap | 1 + .../x-code-samples-override-ir.snap | 1 + .../__snapshots__/x-fern-basic-auth-ir.snap | 2 + .../generators.yml | 5 + .../multi-content-type-examples/openapi.yml | 99 ++ .../__test__/openapi-from-flag.test.ts | 97 +- 48 files changed, 1869 insertions(+), 45 deletions(-) create mode 100644 packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-fdr.snap create mode 100644 packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-ir.snap create mode 100644 packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/generators.yml create mode 100644 packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/openapi.yml diff --git a/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts b/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts index 2ae7bfe7a752..21658b1f763c 100644 --- a/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts +++ b/packages/cli/api-importers/openapi-to-ir/src/3.1/paths/operations/OperationConverter.ts @@ -164,15 +164,17 @@ export class OperationConverter extends AbstractOperationConverter { } } - // When there are still no endpoint-level examples but the per-content-type - // request bodies have v2Examples (from native OAS per-mediaType examples on - // bodies WITH schemas), elevate them to endpoint-level examples tagged with - // their content type. This enables docs to display per-content-type examples. + // When there are still no endpoint-level examples but multiple content types + // have per-body v2Examples (from native OAS per-mediaType examples on bodies + // WITH schemas), elevate them to endpoint-level examples tagged with their + // content type. This enables docs to display per-content-type examples. + // Only fires for multi-content-type endpoints; single-content-type endpoints + // are handled by the normal v1→v2 example synthesis pipeline. if ( Object.keys(fernExamples.examples).length === 0 && Object.keys(fernExamples.streamExamples).length === 0 && convertedRequestBodies != null && - convertedRequestBodies.length > 0 + convertedRequestBodies.length > 1 ) { const perContentTypeExamples = this.synthesizeEndpointExamplesFromPerContentTypeRequestBodies({ convertedRequestBodies, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-fdr.snap index eddf4274ac00..709652925080 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-fdr.snap @@ -163,6 +163,7 @@ "userSpecifiedExamples": { "addPlantExample_Successfully created plant_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Successfully created plant", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-ir.snap index 7971aa2a702f..8cc68e54418a 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/ai-examples-issue-ir.snap @@ -1274,6 +1274,7 @@ "userSpecifiedExamples": { "addPlantExample_Successfully created plant_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Successfully created plant", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-no-titles-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-no-titles-ir.snap index 96463f4bdc8b..0cdd9c078643 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-no-titles-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-no-titles-ir.snap @@ -260,6 +260,7 @@ "autogeneratedExamples": { "anyOfExamplesAnyOfExampleNoTitlesExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "anyOfExamplesAnyOfExampleNoTitlesExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-titled-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-titled-ir.snap index 0fff6f029bad..4085e9ffe78b 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-titled-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/anyOf-titled-ir.snap @@ -260,6 +260,7 @@ "autogeneratedExamples": { "anyOfExamplesAnyOfExampleExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "anyOfExamplesAnyOfExampleExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-name-collision-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-name-collision-ir.snap index dc9f008d0a9a..c1dbc1f90f44 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-name-collision-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-name-collision-ir.snap @@ -189,6 +189,7 @@ "autogeneratedExamples": { "base_getProtectedExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProtectedExample", "request": { "auth": undefined, @@ -350,6 +351,7 @@ "autogeneratedExamples": { "base_getPublicExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getPublicExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-example-selection-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-example-selection-ir.snap index d97832822f34..e2ef1b9018d1 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-example-selection-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-example-selection-ir.snap @@ -319,6 +319,7 @@ Examples should use the first available auth scheme (admin). "autogeneratedExamples": { "createResourceExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createResourceExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-override-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-override-ir.snap index a6ed44f36467..2cbb302c9f12 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-override-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-scheme-override-ir.snap @@ -284,6 +284,7 @@ "autogeneratedExamples": { "base_getProtectedApiKeyExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProtectedApiKeyExample", "request": { "auth": undefined, @@ -462,6 +463,7 @@ "autogeneratedExamples": { "base_getProtectedTokenExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProtectedTokenExample", "request": { "auth": undefined, @@ -627,6 +629,7 @@ "autogeneratedExamples": { "base_getPublicExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getPublicExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-user-docs-priority-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-user-docs-priority-ir.snap index 404691b6aeeb..388bbc5a3256 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-user-docs-priority-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-user-docs-priority-ir.snap @@ -206,6 +206,7 @@ "autogeneratedExamples": { "base_getResourceExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getResourceExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-with-overrides-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-with-overrides-ir.snap index 6e7b499a6e40..436a42bfb06c 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-with-overrides-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/auth-with-overrides-ir.snap @@ -246,6 +246,7 @@ "autogeneratedExamples": { "base_usersListExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "listExample", "request": { "auth": undefined, @@ -499,6 +500,7 @@ "autogeneratedExamples": { "base_usersGetExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/autogen-examples-test-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/autogen-examples-test-ir.snap index c9db9073e7e5..4a8251f6a618 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/autogen-examples-test-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/autogen-examples-test-ir.snap @@ -590,6 +590,7 @@ "autogeneratedExamples": { "base_getPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getPlantExample", "request": { "auth": undefined, @@ -1398,6 +1399,7 @@ "autogeneratedExamples": { "createGardenExample_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createGardenExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-fdr.snap index c40f343a06bd..599083eec770 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-fdr.snap @@ -148,6 +148,7 @@ "userSpecifiedExamples": { "base_getRates_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getRates_example", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-ir.snap index 30c3a5126617..b07c8e3b5944 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/balance-max-null-ir.snap @@ -197,6 +197,7 @@ "userSpecifiedExamples": { "base_getRates_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getRates_example", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/company-file-ref-examples-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/company-file-ref-examples-ir.snap index 2b4f96334bab..843786629f5f 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/company-file-ref-examples-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/company-file-ref-examples-ir.snap @@ -190,6 +190,7 @@ "autogeneratedExamples": { "createACompanyExample_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createACompanyExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/explode-parameter-test-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/explode-parameter-test-ir.snap index e0e5d91f65f7..ca9ea772bf9c 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/explode-parameter-test-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/explode-parameter-test-ir.snap @@ -256,6 +256,7 @@ "autogeneratedExamples": { "base_getItemExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getItemExample", "request": { "auth": undefined, @@ -682,6 +683,7 @@ "autogeneratedExamples": { "base_searchItemsExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "searchItemsExample", "request": { "auth": undefined, @@ -936,6 +938,7 @@ "autogeneratedExamples": { "base_getItemDetailsExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getItemDetailsExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/grpc-comments-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/grpc-comments-ir.snap index 654780b420b2..d9e089822ddb 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/grpc-comments-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/grpc-comments-ir.snap @@ -225,6 +225,7 @@ "autogeneratedExamples": { "commentsServiceCreateCommentExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "commentsServiceCreateCommentExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/http-auth-capital-scheme-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/http-auth-capital-scheme-ir.snap index 681d05c6c0fc..bdd45cec2b3e 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/http-auth-capital-scheme-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/http-auth-capital-scheme-ir.snap @@ -201,6 +201,7 @@ "autogeneratedExamples": { "base_getBasicProtectedExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getBasicProtectedExample", "request": { "auth": undefined, @@ -360,6 +361,7 @@ "autogeneratedExamples": { "base_getBearerProtectedExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getBearerProtectedExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-fdr.snap index 642970c74300..89c4b5a4055e 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-fdr.snap @@ -185,6 +185,7 @@ "userSpecifiedExamples": { "products_createProduct_example_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "products_createProduct_example", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-ir.snap index 943bfa2000e0..3e80093f7000 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/human-examples-preserved-ir.snap @@ -690,6 +690,7 @@ "userSpecifiedExamples": { "products_createProduct_example_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "products_createProduct_example", "request": { "auth": undefined, @@ -1317,6 +1318,7 @@ "autogeneratedExamples": { "base_productsGetProductExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProductExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/min-max-values-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/min-max-values-ir.snap index 5320c1812bda..8e006aa827a4 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/min-max-values-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/min-max-values-ir.snap @@ -275,6 +275,7 @@ "autogeneratedExamples": { "createProductExample_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createProductExample", "request": { "auth": undefined, @@ -589,6 +590,7 @@ "autogeneratedExamples": { "base_getProductExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProductExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-fdr.snap index d362c0aaad50..08b3ef892ea1 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-fdr.snap @@ -153,6 +153,7 @@ "userSpecifiedExamples": { "createUserExample_Successfully created user_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Successfully created user", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-ir.snap index 9423937f5cfd..a639561b7be7 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/mixed-examples-test-ir.snap @@ -855,6 +855,7 @@ "userSpecifiedExamples": { "createUserExample_Successfully created user_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Successfully created user", "request": { "auth": undefined, @@ -1472,6 +1473,7 @@ "autogeneratedExamples": { "base_getProductExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProductExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-fdr.snap new file mode 100644 index 000000000000..02d48d304b60 --- /dev/null +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-fdr.snap @@ -0,0 +1,519 @@ +{ + "apiName": "Multi Content Type Examples", + "auth": undefined, + "authSchemes": {}, + "globalHeaders": [], + "navigation": undefined, + "rootPackage": { + "endpoints": [], + "graphqlOperations": [], + "pointsTo": undefined, + "subpackages": [ + "subpackage_clients", + ], + "types": [ + "ClientRequest", + "ClientResponse", + "Client", + "ClientWithId", + ], + "webhooks": [], + "websockets": [], + }, + "snippetsConfiguration": { + "csharpSdk": undefined, + "goSdk": undefined, + "javaSdk": undefined, + "phpSdk": undefined, + "pythonSdk": undefined, + "rubySdk": undefined, + "rustSdk": undefined, + "swiftSdk": undefined, + "typescriptSdk": undefined, + }, + "subpackages": { + "subpackage_clients": { + "description": undefined, + "displayName": undefined, + "endpoints": [ + { + "auth": false, + "authV2": undefined, + "availability": undefined, + "defaultEnvironment": undefined, + "description": undefined, + "environments": undefined, + "errors": undefined, + "errorsV2": [], + "examples": [ + { + "codeSamples": undefined, + "description": "", + "headers": {}, + "name": "Plain JSON client (application/json)", + "path": "/clients", + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + "requestBodyV3": { + "type": "json", + "value": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "responseBody": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + "responseBodyV3": { + "type": "json", + "value": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "responseStatusCode": 201, + }, + { + "codeSamples": undefined, + "description": "", + "headers": {}, + "name": "JSON-LD client with linked data context (application/ld+json)", + "path": "/clients", + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + "requestBodyV3": { + "type": "json", + "value": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "responseBody": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + "responseBodyV3": { + "type": "json", + "value": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "responseStatusCode": 201, + }, + ], + "headers": [], + "id": "create", + "includeInApiExplorer": undefined, + "method": "POST", + "multiAuth": undefined, + "name": "Create client", + "originalEndpointId": "endpoint_clients.create", + "path": { + "parts": [ + { + "type": "literal", + "value": "", + }, + { + "type": "literal", + "value": "/clients", + }, + ], + "pathParameters": [], + }, + "protocol": { + "type": "rest", + }, + "queryParameters": [], + "request": { + "description": undefined, + "type": { + "contentType": "application/json", + "description": undefined, + "shape": { + "type": "reference", + "value": { + "default": undefined, + "type": "id", + "value": "ClientRequest", + }, + }, + "type": "json", + }, + }, + "requestsV2": { + "requests": [ + { + "description": undefined, + "type": { + "contentType": "application/json", + "description": undefined, + "shape": { + "type": "reference", + "value": { + "default": undefined, + "type": "id", + "value": "ClientRequest", + }, + }, + "type": "json", + }, + }, + { + "description": undefined, + "type": { + "contentType": "application/ld+json", + "description": undefined, + "shape": { + "type": "reference", + "value": { + "default": undefined, + "type": "id", + "value": "ClientRequest", + }, + }, + "type": "json", + }, + }, + ], + }, + "response": { + "description": "Client created successfully", + "isWildcard": undefined, + "statusCode": 201, + "type": { + "type": "reference", + "value": { + "default": undefined, + "type": "id", + "value": "ClientResponse", + }, + }, + }, + "responseHeaders": [], + "responsesV2": { + "responses": [ + { + "description": "Client created successfully", + "isWildcard": undefined, + "statusCode": 201, + "type": { + "type": "reference", + "value": { + "default": undefined, + "type": "id", + "value": "ClientResponse", + }, + }, + }, + ], + }, + "slug": undefined, + "subtitle": undefined, + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "JSON-LD client with linked data context (application/ld+json)": { + "codeSamples": undefined, + "contentType": "application/ld+json", + "displayName": "JSON-LD client with linked data context (application/ld+json)", + "request": { + "auth": undefined, + "baseUrl": undefined, + "docs": undefined, + "endpoint": { + "method": "POST", + "path": "/clients", + }, + "environment": undefined, + "headers": {}, + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "response": { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "docs": undefined, + "statusCode": 201, + }, + }, + "Plain JSON client (application/json)": { + "codeSamples": undefined, + "contentType": "application/json", + "displayName": "Plain JSON client (application/json)", + "request": { + "auth": undefined, + "baseUrl": undefined, + "docs": undefined, + "endpoint": { + "method": "POST", + "path": "/clients", + }, + "environment": undefined, + "headers": {}, + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "response": { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "docs": undefined, + "statusCode": 201, + }, + }, + }, + }, + }, + ], + "graphqlOperations": [], + "name": "clients", + "pointsTo": undefined, + "subpackageId": "subpackage_clients", + "subpackages": [], + "types": [], + "webhooks": [], + "websockets": [], + }, + }, + "types": { + "Client": { + "availability": undefined, + "description": undefined, + "displayName": undefined, + "name": "Client", + "shape": { + "extends": [], + "extraProperties": undefined, + "properties": [ + { + "availability": undefined, + "description": undefined, + "key": "name", + "propertyAccess": undefined, + "valueType": { + "type": "primitive", + "value": { + "default": undefined, + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "regex": undefined, + "type": "string", + }, + }, + }, + { + "availability": undefined, + "description": undefined, + "key": "email", + "propertyAccess": undefined, + "valueType": { + "type": "primitive", + "value": { + "default": undefined, + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "regex": undefined, + "type": "string", + }, + }, + }, + ], + "type": "object", + }, + }, + "ClientRequest": { + "availability": undefined, + "description": undefined, + "displayName": undefined, + "name": "ClientRequest", + "shape": { + "extends": [], + "extraProperties": undefined, + "properties": [ + { + "availability": undefined, + "description": undefined, + "key": "client", + "propertyAccess": undefined, + "valueType": { + "defaultValue": undefined, + "itemType": { + "default": undefined, + "type": "id", + "value": "Client", + }, + "type": "optional", + }, + }, + ], + "type": "object", + }, + }, + "ClientResponse": { + "availability": undefined, + "description": undefined, + "displayName": undefined, + "name": "ClientResponse", + "shape": { + "extends": [], + "extraProperties": undefined, + "properties": [ + { + "availability": undefined, + "description": undefined, + "key": "client", + "propertyAccess": undefined, + "valueType": { + "defaultValue": undefined, + "itemType": { + "default": undefined, + "type": "id", + "value": "ClientWithId", + }, + "type": "optional", + }, + }, + ], + "type": "object", + }, + }, + "ClientWithId": { + "availability": undefined, + "description": undefined, + "displayName": undefined, + "name": "ClientWithId", + "shape": { + "extends": [], + "extraProperties": undefined, + "properties": [ + { + "availability": undefined, + "description": undefined, + "key": "id", + "propertyAccess": undefined, + "valueType": { + "type": "primitive", + "value": { + "default": undefined, + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "regex": undefined, + "type": "string", + }, + }, + }, + { + "availability": undefined, + "description": undefined, + "key": "name", + "propertyAccess": undefined, + "valueType": { + "type": "primitive", + "value": { + "default": undefined, + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "regex": undefined, + "type": "string", + }, + }, + }, + { + "availability": undefined, + "description": undefined, + "key": "email", + "propertyAccess": undefined, + "valueType": { + "type": "primitive", + "value": { + "default": undefined, + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "regex": undefined, + "type": "string", + }, + }, + }, + ], + "type": "object", + }, + }, + }, +} \ No newline at end of file diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-ir.snap new file mode 100644 index 000000000000..1c10acffe0db --- /dev/null +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multi-content-type-examples-ir.snap @@ -0,0 +1,1099 @@ +{ + "apiDisplayName": "Multi Content Type Examples", + "apiDocs": undefined, + "apiName": "Multi Content Type Examples", + "apiPlayground": undefined, + "apiVersion": undefined, + "audiences": undefined, + "auth": { + "docs": undefined, + "requirement": "ALL", + "schemes": [], + }, + "basePath": undefined, + "casingsConfig": undefined, + "constants": { + "errorInstanceIdKey": "errorInstanceId", + }, + "dynamic": undefined, + "environments": undefined, + "errorDiscriminationStrategy": { + "_visit": [Function], + "type": "statusCode", + }, + "errors": {}, + "fdrApiDefinitionId": undefined, + "generationMetadata": undefined, + "headers": [], + "idempotencyHeaders": [], + "pathParameters": [], + "publishConfig": undefined, + "readmeConfig": undefined, + "rootPackage": { + "docs": undefined, + "errors": [], + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "hasEndpointsInTree": false, + "hasWebSocketInTree": undefined, + "navigationConfig": undefined, + "service": undefined, + "subpackages": [ + "subpackage_clients", + ], + "types": [ + "ClientRequest", + "ClientResponse", + "Client", + "ClientWithId", + ], + "webhooks": undefined, + "websocket": undefined, + }, + "sdkConfig": { + "hasFileDownloadEndpoints": false, + "hasPaginatedEndpoints": false, + "hasStreamingEndpoints": false, + "isAuthMandatory": true, + "platformHeaders": { + "language": "", + "sdkName": "", + "sdkVersion": "", + "userAgent": undefined, + }, + }, + "selfHosted": false, + "serviceTypeReferenceInfo": { + "sharedTypes": [], + "typesReferencedOnlyByService": {}, + }, + "services": { + "service_clients": { + "audiences": undefined, + "availability": undefined, + "basePath": { + "head": "", + "parts": [], + }, + "displayName": undefined, + "encoding": undefined, + "endpoints": [ + { + "allPathParameters": [], + "apiPlayground": undefined, + "audiences": [], + "auth": false, + "autogeneratedExamples": [ + { + "example": { + "docs": undefined, + "endpointHeaders": [], + "endpointPathParameters": [], + "id": "129613d1", + "name": undefined, + "queryParameters": [], + "request": { + "_visit": [Function], + "jsonExample": { + "client": undefined, + }, + "shape": { + "_visit": [Function], + "shape": { + "_visit": [Function], + "extraProperties": undefined, + "properties": [ + { + "name": "client", + "originalTypeDeclaration": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientRequest", + "typeId": "ClientRequest", + }, + "propertyAccess": undefined, + "value": { + "jsonExample": undefined, + "shape": { + "_visit": [Function], + "container": { + "_visit": [Function], + "optional": undefined, + "type": "optional", + "valueType": { + "_visit": [Function], + "default": undefined, + "displayName": "Client", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "Client", + "type": "named", + "typeId": "Client", + }, + }, + "type": "container", + }, + }, + }, + ], + "type": "object", + }, + "type": "named", + "typeName": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientRequest", + "typeId": "ClientRequest", + }, + }, + "type": "reference", + }, + "response": { + "_visit": [Function], + "type": "ok", + "value": { + "_visit": [Function], + "type": "body", + "value": { + "jsonExample": { + "client": { + "email": "email", + "id": "id", + "name": "name", + }, + }, + "shape": { + "_visit": [Function], + "shape": { + "_visit": [Function], + "extraProperties": undefined, + "properties": [ + { + "name": "client", + "originalTypeDeclaration": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientResponse", + "typeId": "ClientResponse", + }, + "propertyAccess": undefined, + "value": { + "jsonExample": { + "email": "email", + "id": "id", + "name": "name", + }, + "shape": { + "_visit": [Function], + "container": { + "_visit": [Function], + "optional": { + "jsonExample": { + "email": "email", + "id": "id", + "name": "name", + }, + "shape": { + "_visit": [Function], + "shape": { + "_visit": [Function], + "extraProperties": undefined, + "properties": [ + { + "name": "id", + "originalTypeDeclaration": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientWithId", + "typeId": "ClientWithId", + }, + "propertyAccess": undefined, + "value": { + "jsonExample": "id", + "shape": { + "_visit": [Function], + "primitive": { + "_visit": [Function], + "string": { + "original": "id", + }, + "type": "string", + }, + "type": "primitive", + }, + }, + }, + { + "name": "name", + "originalTypeDeclaration": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientWithId", + "typeId": "ClientWithId", + }, + "propertyAccess": undefined, + "value": { + "jsonExample": "name", + "shape": { + "_visit": [Function], + "primitive": { + "_visit": [Function], + "string": { + "original": "name", + }, + "type": "string", + }, + "type": "primitive", + }, + }, + }, + { + "name": "email", + "originalTypeDeclaration": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientWithId", + "typeId": "ClientWithId", + }, + "propertyAccess": undefined, + "value": { + "jsonExample": "email", + "shape": { + "_visit": [Function], + "primitive": { + "_visit": [Function], + "string": { + "original": "email", + }, + "type": "string", + }, + "type": "primitive", + }, + }, + }, + ], + "type": "object", + }, + "type": "named", + "typeName": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientWithId", + "typeId": "ClientWithId", + }, + }, + }, + "type": "optional", + "valueType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientWithId", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientWithId", + "type": "named", + "typeId": "ClientWithId", + }, + }, + "type": "container", + }, + }, + }, + ], + "type": "object", + }, + "type": "named", + "typeName": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientResponse", + "typeId": "ClientResponse", + }, + }, + }, + }, + }, + "rootPathParameters": [], + "serviceHeaders": [], + "servicePathParameters": [], + "url": "/clients", + }, + }, + ], + "availability": undefined, + "basePath": undefined, + "baseUrl": undefined, + "displayName": "Create client", + "docs": undefined, + "errors": [], + "fullPath": { + "head": "/clients", + "parts": [], + }, + "headers": [], + "id": "endpoint_clients.create", + "idempotent": false, + "method": "POST", + "name": "create", + "pagination": undefined, + "path": { + "head": "/clients", + "parts": [], + }, + "pathParameters": [], + "queryParameters": [], + "requestBody": { + "_visit": [Function], + "contentType": "application/json", + "docs": undefined, + "requestBodyType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientRequest", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientRequest", + "type": "named", + "typeId": "ClientRequest", + }, + "type": "reference", + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "Plain JSON client": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + }, + }, + "response": { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "_visit": [Function], + "docs": "Client created successfully", + "responseBodyType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientResponse", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientResponse", + "type": "named", + "typeId": "ClientResponse", + }, + "type": "response", + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "Plain JSON response": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + }, + }, + }, + "docs": "Client created successfully", + "isWildcardStatusCode": undefined, + "statusCode": 201, + }, + "responseHeaders": [], + "retries": undefined, + "sdkRequest": undefined, + "security": undefined, + "source": { + "_visit": [Function], + "type": "openapi", + }, + "subtitle": undefined, + "transport": undefined, + "userSpecifiedExamples": [], + "v2BaseUrls": undefined, + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "JSON-LD client with linked data context (application/ld+json)": { + "codeSamples": undefined, + "contentType": "application/ld+json", + "displayName": "JSON-LD client with linked data context (application/ld+json)", + "request": { + "auth": undefined, + "baseUrl": undefined, + "docs": undefined, + "endpoint": { + "method": "POST", + "path": "/clients", + }, + "environment": undefined, + "headers": {}, + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "response": { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "docs": undefined, + "statusCode": 201, + }, + }, + "Plain JSON client (application/json)": { + "codeSamples": undefined, + "contentType": "application/json", + "displayName": "Plain JSON client (application/json)", + "request": { + "auth": undefined, + "baseUrl": undefined, + "docs": undefined, + "endpoint": { + "method": "POST", + "path": "/clients", + }, + "environment": undefined, + "headers": {}, + "pathParameters": {}, + "queryParameters": {}, + "requestBody": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + "response": { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + "docs": undefined, + "statusCode": 201, + }, + }, + }, + }, + "v2RequestBodies": { + "requestBodies": [ + { + "_visit": [Function], + "contentType": "application/json", + "docs": undefined, + "requestBodyType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientRequest", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientRequest", + "type": "named", + "typeId": "ClientRequest", + }, + "type": "reference", + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "Plain JSON client": { + "client": { + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + }, + }, + { + "_visit": [Function], + "contentType": "application/ld+json", + "docs": undefined, + "requestBodyType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientRequest", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientRequest", + "type": "named", + "typeId": "ClientRequest", + }, + "type": "reference", + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "JSON-LD client with linked data context": { + "@context": "urn:example:governance-model#", + "client": { + "@type": "Client", + "email": "contact@acme.com", + "name": "Acme Corp", + }, + }, + }, + }, + }, + ], + }, + "v2Responses": { + "responses": [ + { + "body": { + "_visit": [Function], + "type": "json", + "value": { + "_visit": [Function], + "docs": "Client created successfully", + "responseBodyType": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientResponse", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientResponse", + "type": "named", + "typeId": "ClientResponse", + }, + "type": "response", + "v2Examples": { + "autogeneratedExamples": {}, + "userSpecifiedExamples": { + "Plain JSON response": { + "client": { + "email": "contact@acme.com", + "id": "client-123", + "name": "Acme Corp", + }, + }, + }, + }, + }, + }, + "docs": "Client created successfully", + "isWildcardStatusCode": undefined, + "statusCode": 201, + }, + ], + }, + }, + ], + "headers": [], + "name": { + "fernFilepath": { + "allParts": [ + "Clients", + ], + "file": "Clients", + "packagePath": [], + }, + }, + "pathParameters": [], + "transport": undefined, + }, + }, + "sourceConfig": undefined, + "specVersion": undefined, + "subpackages": { + "subpackage_clients": { + "displayName": undefined, + "docs": undefined, + "errors": [], + "fernFilepath": { + "allParts": [ + "clients", + ], + "file": "clients", + "packagePath": [], + }, + "hasEndpointsInTree": false, + "hasWebSocketInTree": undefined, + "name": "clients", + "navigationConfig": undefined, + "service": "service_clients", + "subpackages": [], + "types": [], + "webhooks": undefined, + "websocket": undefined, + }, + }, + "types": { + "Client": { + "autogeneratedExamples": [], + "availability": undefined, + "docs": undefined, + "encoding": undefined, + "inline": false, + "name": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "Client", + "typeId": "Client", + }, + "referencedTypes": Set {}, + "shape": { + "_visit": [Function], + "extendedProperties": [], + "extends": [], + "extraProperties": false, + "properties": [ + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "name", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientName_example_autogenerated": "string", + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "primitive": { + "v1": "STRING", + "v2": { + "_visit": [Function], + "default": undefined, + "type": "string", + "validation": { + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "pattern": undefined, + }, + }, + }, + "type": "primitive", + }, + }, + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "email", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientEmail_example_autogenerated": "string", + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "primitive": { + "v1": "STRING", + "v2": { + "_visit": [Function], + "default": undefined, + "type": "string", + "validation": { + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "pattern": undefined, + }, + }, + }, + "type": "primitive", + }, + }, + ], + "type": "object", + }, + "source": undefined, + "userProvidedExamples": [], + "v2Examples": { + "autogeneratedExamples": { + "Client_example_autogenerated": { + "email": "string", + "name": "string", + }, + }, + "userSpecifiedExamples": {}, + }, + }, + "ClientRequest": { + "autogeneratedExamples": [], + "availability": undefined, + "docs": undefined, + "encoding": undefined, + "inline": false, + "name": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientRequest", + "typeId": "ClientRequest", + }, + "referencedTypes": Set { + "Client", + }, + "shape": { + "_visit": [Function], + "extendedProperties": [], + "extends": [], + "extraProperties": false, + "properties": [ + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "client", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientRequestClient_example_autogenerated": { + "email": "string", + "name": "string", + }, + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "container": { + "_visit": [Function], + "optional": { + "_visit": [Function], + "default": undefined, + "displayName": "Client", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "Client", + "type": "named", + "typeId": "Client", + }, + "type": "optional", + }, + "type": "container", + }, + }, + ], + "type": "object", + }, + "source": undefined, + "userProvidedExamples": [], + "v2Examples": { + "autogeneratedExamples": { + "ClientRequest_example_autogenerated": {}, + }, + "userSpecifiedExamples": {}, + }, + }, + "ClientResponse": { + "autogeneratedExamples": [], + "availability": undefined, + "docs": undefined, + "encoding": undefined, + "inline": false, + "name": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientResponse", + "typeId": "ClientResponse", + }, + "referencedTypes": Set { + "ClientWithId", + }, + "shape": { + "_visit": [Function], + "extendedProperties": [], + "extends": [], + "extraProperties": false, + "properties": [ + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "client", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientResponseClient_example_autogenerated": { + "email": "string", + "id": "string", + "name": "string", + }, + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "container": { + "_visit": [Function], + "optional": { + "_visit": [Function], + "default": undefined, + "displayName": "ClientWithId", + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "inline": false, + "name": "ClientWithId", + "type": "named", + "typeId": "ClientWithId", + }, + "type": "optional", + }, + "type": "container", + }, + }, + ], + "type": "object", + }, + "source": undefined, + "userProvidedExamples": [], + "v2Examples": { + "autogeneratedExamples": { + "ClientResponse_example_autogenerated": {}, + }, + "userSpecifiedExamples": {}, + }, + }, + "ClientWithId": { + "autogeneratedExamples": [], + "availability": undefined, + "docs": undefined, + "encoding": undefined, + "inline": false, + "name": { + "displayName": undefined, + "fernFilepath": { + "allParts": [], + "file": undefined, + "packagePath": [], + }, + "name": "ClientWithId", + "typeId": "ClientWithId", + }, + "referencedTypes": Set {}, + "shape": { + "_visit": [Function], + "extendedProperties": [], + "extends": [], + "extraProperties": false, + "properties": [ + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "id", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientWithIdId_example_autogenerated": "string", + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "primitive": { + "v1": "STRING", + "v2": { + "_visit": [Function], + "default": undefined, + "type": "string", + "validation": { + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "pattern": undefined, + }, + }, + }, + "type": "primitive", + }, + }, + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "name", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientWithIdName_example_autogenerated": "string", + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "primitive": { + "v1": "STRING", + "v2": { + "_visit": [Function], + "default": undefined, + "type": "string", + "validation": { + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "pattern": undefined, + }, + }, + }, + "type": "primitive", + }, + }, + { + "availability": undefined, + "defaultValue": undefined, + "docs": undefined, + "name": "email", + "propertyAccess": undefined, + "v2Examples": { + "autogeneratedExamples": { + "ClientWithIdEmail_example_autogenerated": "string", + }, + "userSpecifiedExamples": {}, + }, + "valueType": { + "_visit": [Function], + "primitive": { + "v1": "STRING", + "v2": { + "_visit": [Function], + "default": undefined, + "type": "string", + "validation": { + "format": undefined, + "maxLength": undefined, + "minLength": undefined, + "pattern": undefined, + }, + }, + }, + "type": "primitive", + }, + }, + ], + "type": "object", + }, + "source": undefined, + "userProvidedExamples": [], + "v2Examples": { + "autogeneratedExamples": { + "ClientWithId_example_autogenerated": { + "email": "string", + "id": "string", + "name": "string", + }, + }, + "userSpecifiedExamples": {}, + }, + }, + }, + "variables": [], + "webhookGroups": {}, + "websocketChannels": undefined, +} \ No newline at end of file diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multiple-security-headers-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multiple-security-headers-ir.snap index 5fdc22223101..f686c9a4f455 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multiple-security-headers-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/multiple-security-headers-ir.snap @@ -437,6 +437,7 @@ "autogeneratedExamples": { "createTransactionExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createTransactionExample", "request": { "auth": undefined, @@ -665,6 +666,7 @@ "autogeneratedExamples": { "createUserTransactionExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createUserTransactionExample", "request": { "auth": undefined, @@ -860,6 +862,7 @@ "autogeneratedExamples": { "base_getMerchantSettingsExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getMerchantSettingsExample", "request": { "auth": undefined, @@ -1032,6 +1035,7 @@ "autogeneratedExamples": { "base_listUsersExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "listUsersExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-discriminator-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-discriminator-ir.snap index 3d23c0cadaef..7cd405f9c323 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-discriminator-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-discriminator-ir.snap @@ -261,6 +261,7 @@ "autogeneratedExamples": { "oneOfExamplesOneOfExampleExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "oneOfExamplesOneOfExampleExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-no-discriminator-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-no-discriminator-ir.snap index 29bd93f961c3..0c8a5b4d8c49 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-no-discriminator-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-no-discriminator-ir.snap @@ -260,6 +260,7 @@ "autogeneratedExamples": { "oneOfExamplesOneOfExampleNoDiscriminatorExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "oneOfExamplesOneOfExampleNoDiscriminatorExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-references-mapping-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-references-mapping-ir.snap index 28944fcf8d50..fb925f86f6d8 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-references-mapping-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-references-mapping-ir.snap @@ -269,6 +269,7 @@ "autogeneratedExamples": { "createEventExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createEventExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-titled-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-titled-ir.snap index 76047a60aa3a..3b9d0ecb22fa 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-titled-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/oneOf-titled-ir.snap @@ -260,6 +260,7 @@ "autogeneratedExamples": { "oneOfExamplesOneOfExampleTitledExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "oneOfExamplesOneOfExampleTitledExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-auth-test-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-auth-test-ir.snap index 7aa4a96bd84d..b3b43f9f331e 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-auth-test-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-auth-test-ir.snap @@ -244,6 +244,7 @@ "autogeneratedExamples": { "base_getProtectedExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getProtectedExample", "request": { "auth": undefined, @@ -403,6 +404,7 @@ "autogeneratedExamples": { "base_getPublicExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getPublicExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-fdr.snap index 64f19972a3a1..9eedb98b3eef 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-fdr.snap @@ -118,6 +118,7 @@ "userSpecifiedExamples": { "base_Paginated Payment List_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Paginated Payment List", "request": { "auth": undefined, @@ -360,6 +361,7 @@ "userSpecifiedExamples": { "Apple Pay Payment_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Apple Pay Payment", "request": { "auth": undefined, @@ -394,6 +396,7 @@ }, "Card Payment_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Card Payment", "request": { "auth": undefined, @@ -428,6 +431,7 @@ }, "base_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Payment Response", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-ir.snap index 2dde51b76623..bd14b1ec4af9 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-example-summary-ir.snap @@ -167,6 +167,7 @@ "userSpecifiedExamples": { "base_Paginated Payment List_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Paginated Payment List", "request": { "auth": undefined, @@ -370,6 +371,7 @@ "userSpecifiedExamples": { "Apple Pay Payment_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Apple Pay Payment", "request": { "auth": undefined, @@ -404,6 +406,7 @@ }, "Card Payment_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Card Payment", "request": { "auth": undefined, @@ -438,6 +441,7 @@ }, "base_Payment Response_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Payment Response", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-from-flag-simple-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-from-flag-simple-ir.snap index 909d9747d074..4f30fe6388c7 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-from-flag-simple-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-from-flag-simple-ir.snap @@ -311,6 +311,7 @@ "autogeneratedExamples": { "base_getHealthExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getHealthExample", "request": { "auth": undefined, @@ -600,6 +601,7 @@ "autogeneratedExamples": { "base_getUserExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getUserExample", "request": { "auth": undefined, @@ -812,6 +814,7 @@ "autogeneratedExamples": { "createUserExample_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createUserExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-overrides-summary-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-overrides-summary-ir.snap index 18496f47711f..df3523927727 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-overrides-summary-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/openapi-overrides-summary-ir.snap @@ -160,6 +160,7 @@ "autogeneratedExamples": { "base_authorizeExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "authorizeExample", "request": { "auth": undefined, @@ -392,6 +393,7 @@ "autogeneratedExamples": { "base_getContactExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getContactExample", "request": { "auth": undefined, @@ -562,6 +564,7 @@ "autogeneratedExamples": { "base_listPaymentsExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "listPaymentsExample", "request": { "auth": undefined, @@ -757,6 +760,7 @@ "autogeneratedExamples": { "createPaymentExample_201": { "codeSamples": undefined, + "contentType": undefined, "displayName": "createPaymentExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-fdr.snap index ed9189804a57..0aa183dea0d8 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-fdr.snap @@ -413,6 +413,7 @@ "userSpecifiedExamples": { "Add a Fern Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Fern Plant", "request": { "auth": undefined, @@ -456,6 +457,7 @@ }, "Add a Flowering Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Flowering Plant", "request": { "auth": undefined, @@ -500,6 +502,7 @@ }, "Add a Succulent_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Succulent", "request": { "auth": undefined, @@ -543,6 +546,7 @@ }, "Add an Outdoor Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add an Outdoor Plant", "request": { "auth": undefined, @@ -587,6 +591,7 @@ }, "base_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "plant_addPlant_example", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-ir.snap index b9f0879c7331..b70ffb454d65 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-level-example-ir.snap @@ -1092,6 +1092,7 @@ "userSpecifiedExamples": { "Add a Fern Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Fern Plant", "request": { "auth": undefined, @@ -1135,6 +1136,7 @@ }, "Add a Flowering Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Flowering Plant", "request": { "auth": undefined, @@ -1179,6 +1181,7 @@ }, "Add a Succulent_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Succulent", "request": { "auth": undefined, @@ -1222,6 +1225,7 @@ }, "Add an Outdoor Plant_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add an Outdoor Plant", "request": { "auth": undefined, @@ -1266,6 +1270,7 @@ }, "base_plant_addPlant_example_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "plant_addPlant_example", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-status-code-examples-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-status-code-examples-ir.snap index f7727378420a..1651cd4541bb 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-status-code-examples-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/response-status-code-examples-ir.snap @@ -415,6 +415,7 @@ "autogeneratedExamples": { "sessionsCreateSessionExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "sessionsCreateSessionExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-fdr.snap index 8f89e03010bf..9948eaae2a6c 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-fdr.snap @@ -377,6 +377,7 @@ "userSpecifiedExamples": { "Add a Fern Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Fern Plant", "request": { "auth": undefined, @@ -420,6 +421,7 @@ }, "Add a Flowering Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Flowering Plant", "request": { "auth": undefined, @@ -464,6 +466,7 @@ }, "Add a Succulent_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Succulent", "request": { "auth": undefined, @@ -507,6 +510,7 @@ }, "Add an Outdoor Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add an Outdoor Plant", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-ir.snap index e9178153e3ad..668d400f6e17 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/schema-level-example-ir.snap @@ -1092,6 +1092,7 @@ "userSpecifiedExamples": { "Add a Fern Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Fern Plant", "request": { "auth": undefined, @@ -1135,6 +1136,7 @@ }, "Add a Flowering Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Flowering Plant", "request": { "auth": undefined, @@ -1179,6 +1181,7 @@ }, "Add a Succulent_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add a Succulent", "request": { "auth": undefined, @@ -1222,6 +1225,7 @@ }, "Add an Outdoor Plant_plantAddPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "Add an Outdoor Plant", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/throttled-error-response-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/throttled-error-response-ir.snap index da285ce24ecc..b60de40c1bf1 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/throttled-error-response-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/throttled-error-response-ir.snap @@ -237,6 +237,7 @@ "autogeneratedExamples": { "base_getResourceExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getResourceExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/wildcard-status-conflict-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/wildcard-status-conflict-ir.snap index 1431ceac42cd..866891e7cf50 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/wildcard-status-conflict-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/wildcard-status-conflict-ir.snap @@ -411,6 +411,7 @@ "autogeneratedExamples": { "testOperationExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "testOperationExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-ir.snap index 64fcf2d4ebe4..6323b60d3872 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-ir.snap @@ -277,6 +277,7 @@ func main() { "name": "Go SDK", }, ], + "contentType": undefined, "displayName": "getUserExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-fdr.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-fdr.snap index 5c143eb7af91..d797404c5cef 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-fdr.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-fdr.snap @@ -200,6 +200,7 @@ puts user.name", "name": "Ruby SDK (Fern)", }, ], + "contentType": undefined, "displayName": undefined, "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-ir.snap index 806d6dbc649a..93ad2e87c316 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-code-samples-override-ir.snap @@ -265,6 +265,7 @@ puts user.name", "name": "Ruby SDK (Fern)", }, ], + "contentType": undefined, "displayName": undefined, "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-fern-basic-auth-ir.snap b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-fern-basic-auth-ir.snap index ca2797b1b3d3..7eec5d66a1d0 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-fern-basic-auth-ir.snap +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/__snapshots__/x-fern-basic-auth-ir.snap @@ -299,6 +299,7 @@ "autogeneratedExamples": { "base_listPlantsExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "listPlantsExample", "request": { "auth": undefined, @@ -565,6 +566,7 @@ "autogeneratedExamples": { "base_getPlantExample_200": { "codeSamples": undefined, + "contentType": undefined, "displayName": "getPlantExample", "request": { "auth": undefined, diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/generators.yml b/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/generators.yml new file mode 100644 index 000000000000..8a83d39a5bac --- /dev/null +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/generators.yml @@ -0,0 +1,5 @@ +# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json +api: + specs: + - openapi: openapi.yml +groups: {} diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/openapi.yml b/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/openapi.yml new file mode 100644 index 000000000000..bb578fe39ac3 --- /dev/null +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/fixtures/multi-content-type-examples/openapi.yml @@ -0,0 +1,99 @@ +openapi: 3.1.0 +info: + title: Multi Content Type Examples + version: 1.0.0 +paths: + /clients: + post: + operationId: clients_create + tags: + - Clients + summary: Create client + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/ClientRequest" + examples: + NewClientJson: + summary: Plain JSON client + value: + client: + name: "Acme Corp" + email: "contact@acme.com" + application/ld+json: + schema: + $ref: "#/components/schemas/ClientRequest" + examples: + NewClientJsonLd: + summary: JSON-LD client with linked data context + value: + "@context": "urn:example:governance-model#" + client: + "@type": "Client" + name: "Acme Corp" + email: "contact@acme.com" + responses: + "201": + description: Client created successfully + content: + application/json: + schema: + $ref: "#/components/schemas/ClientResponse" + examples: + CreatedClientJson: + summary: Plain JSON response + value: + client: + id: "client-123" + name: "Acme Corp" + email: "contact@acme.com" + application/ld+json: + schema: + $ref: "#/components/schemas/ClientResponse" + examples: + CreatedClientJsonLd: + summary: JSON-LD response with linked data context + value: + "@context": "urn:example:governance-model#" + client: + "@type": "Client" + id: "client-123" + name: "Acme Corp" + email: "contact@acme.com" +components: + schemas: + ClientRequest: + type: object + properties: + client: + $ref: "#/components/schemas/Client" + ClientResponse: + type: object + properties: + client: + $ref: "#/components/schemas/ClientWithId" + Client: + type: object + properties: + name: + type: string + email: + type: string + required: + - name + - email + ClientWithId: + type: object + properties: + id: + type: string + name: + type: string + email: + type: string + required: + - id + - name + - email diff --git a/packages/cli/register/src/ir-to-fdr-converter/__test__/openapi-from-flag.test.ts b/packages/cli/register/src/ir-to-fdr-converter/__test__/openapi-from-flag.test.ts index dc14b5c300f3..24527986436f 100644 --- a/packages/cli/register/src/ir-to-fdr-converter/__test__/openapi-from-flag.test.ts +++ b/packages/cli/register/src/ir-to-fdr-converter/__test__/openapi-from-flag.test.ts @@ -3186,26 +3186,6 @@ describe("OpenAPI v3 Parser Pipeline (--from-openapi flag)", () => { expect(intermediateRepresentation.services).toBeDefined(); expect(fdrApiDefinition.rootPackage).toBeDefined(); - console.log("=== SCHEMA-LEVEL EXAMPLE TEST ==="); - console.log("Root package endpoints:", fdrApiDefinition.rootPackage.endpoints?.length || 0); - console.log("Subpackages:", Object.keys(fdrApiDefinition.subpackages || {})); - - let addPlantEndpoint; - if (fdrApiDefinition.rootPackage.endpoints && fdrApiDefinition.rootPackage.endpoints.length > 0) { - addPlantEndpoint = fdrApiDefinition.rootPackage.endpoints[0]; - } else { - for (const subpackage of Object.values(fdrApiDefinition.subpackages)) { - if (subpackage.endpoints && subpackage.endpoints.length > 0) { - addPlantEndpoint = subpackage.endpoints[0]; - break; - } - } - } - - console.log("Number of examples in FDR endpoint:", addPlantEndpoint?.examples?.length || 0); - console.log("Examples:", JSON.stringify(addPlantEndpoint?.examples, null, 2)); - console.log("=== END SCHEMA-LEVEL EXAMPLE TEST ==="); - await expect(fdrApiDefinition).toMatchFileSnapshot("__snapshots__/schema-level-example-fdr.snap"); await expect(intermediateRepresentation).toMatchFileSnapshot("__snapshots__/schema-level-example-ir.snap"); }); @@ -3261,26 +3241,6 @@ describe("OpenAPI v3 Parser Pipeline (--from-openapi flag)", () => { expect(intermediateRepresentation.services).toBeDefined(); expect(fdrApiDefinition.rootPackage).toBeDefined(); - console.log("=== RESPONSE-LEVEL EXAMPLE TEST ==="); - console.log("Root package endpoints:", fdrApiDefinition.rootPackage.endpoints?.length || 0); - console.log("Subpackages:", Object.keys(fdrApiDefinition.subpackages || {})); - - let addPlantEndpoint; - if (fdrApiDefinition.rootPackage.endpoints && fdrApiDefinition.rootPackage.endpoints.length > 0) { - addPlantEndpoint = fdrApiDefinition.rootPackage.endpoints[0]; - } else { - for (const subpackage of Object.values(fdrApiDefinition.subpackages)) { - if (subpackage.endpoints && subpackage.endpoints.length > 0) { - addPlantEndpoint = subpackage.endpoints[0]; - break; - } - } - } - - console.log("Number of examples in FDR endpoint:", addPlantEndpoint?.examples?.length || 0); - console.log("Examples:", JSON.stringify(addPlantEndpoint?.examples, null, 2)); - console.log("=== END RESPONSE-LEVEL EXAMPLE TEST ==="); - await expect(fdrApiDefinition).toMatchFileSnapshot("__snapshots__/response-level-example-fdr.snap"); await expect(intermediateRepresentation).toMatchFileSnapshot("__snapshots__/response-level-example-ir.snap"); }); @@ -3426,4 +3386,61 @@ describe("OpenAPI v3 Parser Pipeline (--from-openapi flag)", () => { expect(fdrApiDefinition.types).toBeDefined(); expect(fdrApiDefinition.rootPackage).toBeDefined(); }); + + it("should extract per-content-type examples when multiple content types share a schema", async () => { + const context = createMockTaskContext(); + const workspace = await loadAPIWorkspace({ + absolutePathToWorkspace: join( + AbsoluteFilePath.of(__dirname), + RelativeFilePath.of("fixtures/multi-content-type-examples") + ), + context, + cliVersion: "0.0.0", + workspaceName: "multi-content-type-examples" + }); + + expect(workspace.didSucceed).toBe(true); + assert(workspace.didSucceed); + + if (!(workspace.workspace instanceof OSSWorkspace)) { + throw new Error( + `Expected OSSWorkspace for OpenAPI processing, got ${workspace.workspace.constructor.name}` + ); + } + + const intermediateRepresentation = await workspace.workspace.getIntermediateRepresentation({ + context, + audiences: { type: "all" }, + enableUniqueErrorsPerEndpoint: true, + generateV1Examples: true, + logWarnings: false + }); + + const fdrApiDefinition = await convertIrToFdrApi({ + ir: intermediateRepresentation, + snippetsConfig: { + typescriptSdk: undefined, + pythonSdk: undefined, + javaSdk: undefined, + rubySdk: undefined, + goSdk: undefined, + csharpSdk: undefined, + phpSdk: undefined, + swiftSdk: undefined, + rustSdk: undefined + }, + playgroundConfig: { + oauth: true + }, + context + }); + + expect(intermediateRepresentation.services).toBeDefined(); + expect(fdrApiDefinition.rootPackage).toBeDefined(); + + await expect(fdrApiDefinition).toMatchFileSnapshot("__snapshots__/multi-content-type-examples-fdr.snap"); + await expect(intermediateRepresentation).toMatchFileSnapshot( + "__snapshots__/multi-content-type-examples-ir.snap" + ); + }); }); From ae206b195f97c5381f9f8387da7d4b3a7eb46209 Mon Sep 17 00:00:00 2001 From: "adi.david" Date: Thu, 25 Jun 2026 18:58:19 +0000 Subject: [PATCH 3/4] fix: update protoc-gen-fern ETE snapshot with contentType field Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../__snapshots__/protoc-gen-fern.test.ts.snap | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/cli/ete-tests/src/tests/protoc-gen-fern/__snapshots__/protoc-gen-fern.test.ts.snap b/packages/cli/ete-tests/src/tests/protoc-gen-fern/__snapshots__/protoc-gen-fern.test.ts.snap index f4eb534352df..39a857f654e1 100644 --- a/packages/cli/ete-tests/src/tests/protoc-gen-fern/__snapshots__/protoc-gen-fern.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/protoc-gen-fern/__snapshots__/protoc-gen-fern.test.ts.snap @@ -39378,6 +39378,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "0": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -40514,6 +40515,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "1": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -41650,6 +41652,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "2": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -42788,6 +42791,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "3": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -43939,6 +43943,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "4": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -44063,6 +44068,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "5": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -45264,6 +45270,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "0": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -47494,6 +47501,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "1": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -48683,6 +48691,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "2": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -49875,6 +49884,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "3": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", @@ -51116,6 +51126,7 @@ exports[`fern protoc-gen-fern > test with buf 1`] = ` "autogeneratedExamples": { "4": { "displayName": null, + "contentType": null, "request": { "endpoint": { "method": "POST", From 53a22332f97b4f9b5b54c547e34e8775fe374c97 Mon Sep 17 00:00:00 2001 From: "adi.david" Date: Thu, 25 Jun 2026 19:07:22 +0000 Subject: [PATCH 4/4] fix: add ir-to-jsonschema snapshots for multi-content-type-examples fixture Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- .../type__Client.json | 17 +++++++++ .../type__ClientResponse.json | 38 +++++++++++++++++++ .../type__ClientWithId.json | 21 ++++++++++ 3 files changed, 76 insertions(+) create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__Client.json create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientResponse.json create mode 100644 packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientWithId.json diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__Client.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__Client.json new file mode 100644 index 000000000000..85a3f1e28fed --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__Client.json @@ -0,0 +1,17 @@ +{ + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "required": [ + "name", + "email" + ], + "additionalProperties": false, + "definitions": {} +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientResponse.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientResponse.json new file mode 100644 index 000000000000..ff1d424b8b7b --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientResponse.json @@ -0,0 +1,38 @@ +{ + "type": "object", + "properties": { + "client": { + "oneOf": [ + { + "$ref": "#/definitions/ClientWithId" + }, + { + "type": "null" + } + ] + } + }, + "additionalProperties": false, + "definitions": { + "ClientWithId": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "email" + ], + "additionalProperties": false + } + } +} \ No newline at end of file diff --git a/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientWithId.json b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientWithId.json new file mode 100644 index 000000000000..304e2f169dd3 --- /dev/null +++ b/packages/cli/fern-definition/ir-to-jsonschema/src/__test__/__snapshots__/multi-content-type-examples/type__ClientWithId.json @@ -0,0 +1,21 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "email": { + "type": "string" + } + }, + "required": [ + "id", + "name", + "email" + ], + "additionalProperties": false, + "definitions": {} +} \ No newline at end of file