tsoa icon indicating copy to clipboard operation
tsoa copied to clipboard

title: add from annotation

Open orgoro opened this issue 5 months ago • 4 comments

This pull request adds support for extracting and including @title JSDoc annotations from TypeScript models and properties into the generated OpenAPI/Swagger schema definitions. It does so by updating the metadata generation pipeline to read the title annotation and propagate it through all relevant types, transformers, and spec generators. Comprehensive tests are added to verify that the title annotation appears correctly in the output schemas.

These changes ensure that descriptive title annotations are preserved from source code to API documentation, improving schema clarity for consumers.

All Submissions:

  • [x] Have you followed the guidelines in our Contributing document?
  • [x] Have you checked to ensure there aren't other open Pull Requests for the same update/change?
  • [x] Have you written unit tests?
  • [ ] Have you written unit tests that cover the negative cases (i.e.: if bad data is submitted, does the library respond properly)?
  • [x] This PR is associated with an existing issue?

Closing issues closes #1656

Put closes #XXXX (where XXXX is the issue number) in your comment to auto-close the issue that your PR fixes.

If this is a new feature submission:

  • [ ] Has the issue had a maintainer respond to the issue and clarify that the feature is something that aligns with the goals and philosophy of the project?

Potential Problems With The Approach

Test plan

  • Added a new TestModelWithAnnotations fixture with @title JSDoc annotations at both model and property levels to verify extraction and propagation. (tests/fixtures/testModel.ts, [1]; [2]
  • Expanded unit and integration tests to validate that the generated schemas correctly include title for models and properties, including OpenAPI 3 specific checks. (tests/unit/swagger/schemaDetails3.spec.ts, [1]; [2]; [3]; [4]

orgoro avatar Nov 09 '25 22:11 orgoro

Wasn't this issue closed with: https://github.com/lukeautry/tsoa/pull/1657?

jefflembeck avatar Nov 10 '25 18:11 jefflembeck

@jefflembeck

#1657 doesn't handle references and merges

Also the test in that was added in the PR was a title to Property and not Schema (or ref schema / property)

I use Tsoa and @ title behavior is unpredictable because of this

orgoro avatar Nov 24 '25 06:11 orgoro

@jefflembeck what do you think we should do next?

orgoro avatar Dec 01 '25 11:12 orgoro

@orgoro I'm gonna be honest, man. I have an internal fork of TSOA for my company. YMMV if that's the appropriate avenue to take for you. I don't have the overhead time to even attempt forking this project as a whole.

jefflembeck avatar Dec 01 '25 17:12 jefflembeck

Does this intentionally omit refEnums?

WoH avatar Dec 14 '25 18:12 WoH

I think this should now be complete. Lmk if I missed something, but I think we want to pass through property titles, not silently swallow them.

WoH avatar Dec 14 '25 19:12 WoH