OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
20.56k stars 6.28k forks source link

[BUG][typescript-angular] Description is missing in JSDoc with$ref #18925

Open Quentigus opened 2 weeks ago

Quentigus commented 2 weeks ago

Bug Report Checklist

openapi-generator version

Version: 7.3.0 Regression: ?

Description

JSDoc description are not generated on $ref properties.

Actual Output
/**
 * Class based documentation
 */
export interface Object1 { 
    property: Object1;
} 

/**
 * Class based documentation
 */
export interface Object2 {
    [k: string]: unknown;
} 

Expected Output

/**
 * Class based documentation
 */
export interface Object1 { 
    /**
     * Property documentation
     */
    property: Object1;
} 

/**
 * Class based documentation
 */
export interface Object2 {
    [k: string]: unknown;
} 
Steps to reproduce
npx openapi-generator-cli generate -g typescript-angular -i ./swagger.json -o ./output`
OpenAPI declaration file content or url
{
  "swagger": "2.0",
  "info": {
    "description": "Backend",
    "version": "1.0.0",
    "title": "API"
  },
  "basePath": "/api",
  "schemes": [
    "http",
    "https"
  ],
  "paths": {
    "/sample": {
      "get": {
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "responses": {
          "200": {
            "description": "successful operation",
            "schema": {
              "$ref": "#/definitions/Object1"
            }
          }
        }
      }
    }
  },
  "definitions": {
    "Object1": {
      "type": "object",
      "description": "Class based documentation",
      "properties": {
        "property": {
          "description": "Property documentation",
          "$ref": "#/definitions/Object2"
        }
      }
    },
    "Object2": {
      "description": "Class based documentation",
      "type": "object",
      "additionalProperties": true
    }
  }
}