Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#25030·openapi-generator

[BUG] Description from unrelated query parameter assigned to field in schema

Author: jg50hzCreated Sep 28, 2026Updated Sep 28, 2026
LabelsIssue: Bug

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When generating typescript-angular code, it was noticed that a field in a schema got the description of a seemingly unrelated query parameter. The field is an optional, nullable string. Changing the type in any way (making it required, making it non-nullable) leads to the correct description being assigned.

Generating code for other languages had the same issue, so it sounds like it's some problem prior to actual code generation.

openapi-generator version

Tried v7.23.0, v7.24.0, v7.25.0.

OpenAPI declaration file content or url
json
{
  "openapi": "3.1.0",
  "info": {
    "title": "minimal example - description bug",
    "description": "-",
    "version": "0.0.0"
  },
  "paths": {
    "/book": {
      "get": {
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Book"
                }
              }
            }
          }
        }
      }
    },
    "/book-with-pages": {
      "get": {
        "parameters": [
          {
            "name": "conflicting-param",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "WRONG DESCRIPTION! (schema)"
            },
            "description": "WRONG DESCRIPTION! (parameter)"
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Book"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Book": {
        "properties": {
          "broken_field": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "default": null,
            "description": "Correct description."
          }
        },
        "title": "Book",
        "type": "object"
      }
    }
  }
}
Generation Details

No specific configuration:

bash
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v7.25.0 generate -i /local/openapi-spec-minimal.json -g typescript-angular -o /local/clientsdk

Generates in book.ts:

typescript
export interface Book { 
    /**
     * WRONG DESCRIPTION! (schema)
     */
    broken_field?: string | null;
}

Expected output:

typescript
export interface Book { 
    /**
     * Correct description.
     */
    broken_field?: string | null;
}
Related issues/PRs

I could not find any, but it might be hard to find just based on the description.

Source: OpenAPITools/openapi-generator

View original on GitHubView discussion on GitHub