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] Non-200 2xx status codes are displayed as 200 in API reference #5144

Open hkosova opened 1 week ago

hkosova commented 1 week ago

Describe the Bug

Fern's API reference docs seem to assume that all 2xx status codes are equivalent to 200. Regardless of which 2xx code is defined in the OpenAPI spec, API reference always displays it as "200 Successful".

This can confuse API consumers: if they receive e.g. 201 but the docs say 200, they might wonder why docs don't match the implementation and whether it's a bug in docs or in the API itself.

Information to Reproduce

CLI Version

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

Actual Behavior

All 2xx response status codes are displayed as 200:

Expected Behavior

API reference should display the exact HTTP status code defined in the OpenAPI document. E.g. display 201 as "201 Created", 202 as "202 Accepted", etc.

API Definition

openapi: 3.1.0
info:
  title: Non-200 2xx response codes
  version: 1.0.0
servers:
  - url: https://httpbin.org/anything
paths:
  /foos:
    post:
      summary: Create a foo
      responses:
        '201':
          description: A foo has been successfully created
          content:
            application/json:
              schema:
                type: string
  /smth:
    post:
      summary: Do something async
      responses:
        '202':
          description: Request accepted. Poll the resource in the `Location` header to await processing completion.
          content:
            application/json:
              schema:
                type: string

Additional notes