OpenAPITools / OpenAPITools/openapi-generator
[BUG][typescript-angular] Description is missing in JSDoc with$ref
Open
Nobody has claimed this yet.
Issue: Bug
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- 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)
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
}
}
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Run the shown openapi-generator-cli command with the provided swagger.json and inspect the generated interfaces in ./output. Compare the property JSDoc for Object1 with the expected output, then trace the typescript-angular generator entry point to identify where descriptions for $ref properties are handled. Done means the generated property includes "Property documentation" while preserving the existing class documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- angular, typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100