title: add from annotation
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
TestModelWithAnnotationsfixture with@titleJSDoc 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
titlefor models and properties, including OpenAPI 3 specific checks. (tests/unit/swagger/schemaDetails3.spec.ts, [1]; [2]; [3]; [4]
Wasn't this issue closed with: https://github.com/lukeautry/tsoa/pull/1657?
@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
@jefflembeck what do you think we should do next?
@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.
Does this intentionally omit refEnums?
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.