fern-api / fern

Input OpenAPI. Output SDKs and Docs.
https://buildwithfern.com
Apache License 2.0
2.69k stars 151 forks source link

[Bug][OpenAPI] 2xx responses with no content are not displayed in API Reference #5145

Open hkosova opened 1 week ago

hkosova commented 1 week ago

Describe the Bug

Fern's API reference currently displays 2xx responses only if they have content, i.e. a response body. But HTTP responses don't necessarily have a body.

A typical example is 204 No Content commonly returned by DELETE requests (see the sample spec below). 200 responses also may not have a body depending on the use case.

Information to Reproduce

CLI Version

0.44.11, but goes back to 0.31.14 so most likely all versions.

Actual Behavior

2xx responses without content are not displayed in the API reference.

Expected Behavior

API reference should always show the response code returned. Something like this:

API Definition

openapi: 3.1.0
info:
  title: Responses without a body
  version: 1.0.0
servers:
  - url: https://httpbin.org/anything
paths:
  /foos:
    delete:
      summary: Delete a foo
      responses:
        '204':
          description: This one is displayed
          content:
            application/json: {}

  /bars:
    delete:
      summary: Delete a bar
      responses:
        '204':
          description: This one is NOT displayed

Additional Context

4xx and 5xx responses are not affected by this limitation, they are always displayed regardless of whether or not they have content (assuming display-errors: true config is used.)