diff --git a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts b/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts index bfed460442e..53ce92d404b 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts +++ b/packages/cli/api-importers/openapi/openapi-ir-parser/src/openapi/v3/converters/ExampleEndpointFactory.ts @@ -104,6 +104,15 @@ export class ExampleEndpointFactory { if (responseSchemaIdResponse != null && responseSchemaIdResponse.type === "present") { const required = this.isSchemaRequired(responseSchemaIdResponse.schema); + if (endpoint.response?.type === "json" && endpoint.response.statusCode === 204) { + responseExamples.push([ + undefined, + EndpointResponseExample.withoutStreaming(FullExample.object({ + properties: {} + })) + ]); + } + if (responseSchemaIdResponse.examples.length === 0) { const example = this.exampleTypeFactory.buildExample({ skipReadonly: false, diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/deel.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/deel.json index d4931a7981f..9b5106c4f26 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/deel.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-docs/deel.json @@ -23783,6 +23783,14 @@ docs: The Contracts resource lets you create, amend and, retrieve Deel contracts "root.ArchiveContractRequestInternalServerError", ], "examples": [ + { + "path-parameters": { + "contract_id": "37nex2x", + }, + "response": { + "body": {}, + }, + }, { "path-parameters": { "contract_id": "37nex2x", @@ -25080,6 +25088,10 @@ service: - root.ArchiveContractRequestNotFoundError - root.ArchiveContractRequestInternalServerError examples: + - path-parameters: + contract_id: 37nex2x + response: + body: {} - path-parameters: contract_id: 37nex2x response: diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/deel.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/deel.json index ceff46eaaf3..d7465cd888e 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/deel.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi-ir/deel.json @@ -11571,6 +11571,31 @@ "method": "PATCH", "path": "/contracts/{contract_id}/archive", "examples": [ + { + "pathParameters": [ + { + "name": "contract_id", + "value": { + "value": { + "value": "37nex2x", + "type": "string" + }, + "type": "primitive" + } + } + ], + "queryParameters": [], + "headers": [], + "response": { + "value": { + "properties": {}, + "type": "object" + }, + "type": "withoutStreaming" + }, + "codeSamples": [], + "type": "full" + }, { "pathParameters": [ { diff --git a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/deel.json b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/deel.json index 47b959e6981..c7b44dc9a85 100644 --- a/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/deel.json +++ b/packages/cli/api-importers/openapi/openapi-ir-to-fern-tests/src/__test__/__snapshots__/openapi/deel.json @@ -14153,6 +14153,14 @@ docs: The Contracts resource lets you create, amend and, retrieve Deel contracts "root.InternalServerError", ], "examples": [ + { + "path-parameters": { + "contract_id": "37nex2x", + }, + "response": { + "body": {}, + }, + }, { "path-parameters": { "contract_id": "37nex2x", @@ -15450,6 +15458,10 @@ service: - root.NotFoundError - root.InternalServerError examples: + - path-parameters: + contract_id: 37nex2x + response: + body: {} - path-parameters: contract_id: 37nex2x response: diff --git a/packages/cli/cli/versions.yml b/packages/cli/cli/versions.yml index 20d53630f51..25bfb25c348 100644 --- a/packages/cli/cli/versions.yml +++ b/packages/cli/cli/versions.yml @@ -1,3 +1,10 @@ +- changelogEntry: + - summary: | + The OpenAPI parser generates response examples that are `{}` for 204 response types. + type: fix + irVersion: 55 + version: 0.51.10 + - changelogEntry: - summary: | Fixed OpenAPI importer to properly handle response status codes in documentation by propagating diff --git a/packages/cli/ete-tests/src/tests/help/__snapshots__/help.test.ts.snap b/packages/cli/ete-tests/src/tests/help/__snapshots__/help.test.ts.snap index 54b1dd435b7..3bd153bc02d 100644 --- a/packages/cli/ete-tests/src/tests/help/__snapshots__/help.test.ts.snap +++ b/packages/cli/ete-tests/src/tests/help/__snapshots__/help.test.ts.snap @@ -1,9 +1,7 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`help > no arguments 1`] = ` -"(node:76082) [DEP0040] DeprecationWarning: The \`punycode\` module is deprecated. Please use a userland alternative instead. -(Use \`node --trace-deprecation ...\` to show where the warning was created) -fern-dev +"fern-dev Commands: fern-dev init Initialize a Fern API diff --git a/packages/cli/ete-tests/src/tests/jsonschema/__snapshots__/jsonschema.test.ts.snap b/packages/cli/ete-tests/src/tests/jsonschema/__snapshots__/jsonschema.test.ts.snap new file mode 100644 index 00000000000..d8e8bdaa3e1 --- /dev/null +++ b/packages/cli/ete-tests/src/tests/jsonschema/__snapshots__/jsonschema.test.ts.snap @@ -0,0 +1,29 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`jsonschema > works with latest version 1`] = ` +{ + "additionalProperties": false, + "definitions": { + "imdb.MovieId": { + "type": "string", + }, + }, + "properties": { + "id": { + "$ref": "#/definitions/imdb.MovieId", + }, + "rating": { + "type": "number", + }, + "title": { + "type": "string", + }, + }, + "required": [ + "id", + "title", + "rating", + ], + "type": "object", +} +`;