feat: add tsoa for API type control and documentation#1501
Conversation
✅ Deploy Preview for endearing-brigadeiros-63f9d0 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
jescalada
left a comment
There was a problem hiding this comment.
Thanks for the contribution, @Andreybest! 🚀
Things are looking good so far, just a few things to mention other than the code comments:
- It'd be great to have screenshots of the generated OpenAPI spec to see if things are working as we hoped
- I noticed a duplicate interface (
AttestationAnswer) and am wondering if there aren't other interfaces that can be reused or combined into one - Test coverage seems to go down somewhat (-1.5%), we should improve coverage on any code additions such as
proxyStore.ts, etc.
We might need another review since the changes are quite large @finos/git-proxy-maintainers
|
@jescalada and @Andreybest There is a docusaurus plugin for rendering OpenAPI docs at: https://docusaurus-openapi.tryingpan.dev/ Whereas in the FDC3 website we use a very simple static page and the Redoc lib to render the same: https://github.com/finos/FDC3/blob/main/website/src/pages/schemas/next/app-directory.html Note that you have to link to this as an external link or docusaurus will return a 404 when navigating within the site: |
|
Thank you for the review @jescalada !
2. Duplicate removed, quickly checked, should be no more repetiotions (but not sure)
3. Don't see a message from code cov bot on this matter, can you please show me where I can find a code coverage stats?
|
|
Checked all commits on main branch for new changes to logic for endpoints. None was changed, checked up to commit |
Co-authored-by: Fabio Vincenzi <93596376+fabiovincenzi@users.noreply.github.com> Signed-off-by: Andrew <andrey255@live.com>
|
Thanks for change @fabiovincenzi ! Added your suggested change. |
|
Checked all commits on main branch for new changes to logic for endpoints. None was changed, checked up to commit: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1501 +/- ##
==========================================
- Coverage 85.51% 85.38% -0.13%
==========================================
Files 83 85 +2
Lines 7877 9137 +1260
Branches 1312 1327 +15
==========================================
+ Hits 6736 7802 +1066
- Misses 1114 1305 +191
- Partials 27 30 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
re-vlad
left a comment
There was a problem hiding this comment.
just small non critical change requested
|
Checked all commits on main branch for new changes to logic for endpoints. Only change with addition of https server, which required to change test files for https, would appreciate check on this. Checked up to commit: |
jescalada
left a comment
There was a problem hiding this comment.
@Andreybest LGTM, just needs fixes for the failing tests!
It seems this commit (a23b7eb) breaks them - I'm wondering if it's due to the throw-on-error option we added, or the tweaks to the repo tests themselves 🤔
|
Thank you @jescalada! Sorry for not replying on previous review. |
|
Checked all commits on main branch for new changes to logic for endpoints. None was changed, checked up to commit: |
* feat: generate API reference docs from OpenAPI spec * fix: escape backslashes before pipes in Markdown table descriptions
Signed-off-by: Juan Escalada <97265671+jescalada@users.noreply.github.com>
a5df2cb to
b2d07a6
Compare
|
Just pushed fixes for the E2E (Docker) and Cypress tests. The Meanwhile the Dependency error is coming from critical vulnerabilities in our |
|
@kriswest I think this can be reviewed again since Dependency Review isn't a required check. I'll do the Vitest upgrade in a separate PR! |
|
Hey @jescalada! Thanks for the fixes! Merged latest main to PR and added suggestion from @fabiovincenzi on pre-commit generation of web docs (just like generatedRoutes being automatically generated on commit). |
|
Checked all commits on main branch for new changes to logic for endpoints. On main new feature for getting params from config for server configuration was added to |
| "start": "concurrently \"npm run server\" \"npm run client\"", | ||
| "build": "npm run generate-config-types && npm run build-ui && npm run build-ts", | ||
| "build-ts": "tsc --project tsconfig.publish.json && node scripts/fix-shebang.js", | ||
| "build-ts": "npm run build-tsoa && tsc --project tsconfig.publish.json && node scripts/fix-shebang.js", |
There was a problem hiding this comment.
you possibly need to add a run of the format script here as the generated code fails linting, but can be autofixed - which would stop this PR (and future ones) failing the linting check.
Alternatively see how generate-config-types runs prettier on a specific file
There was a problem hiding this comment.
I don't think that we need to format generated files, I've actually added generatedRoutes.ts to .prettierIgnore, but it was not used, now it is fixed.
There was a problem hiding this comment.
I'm not bothered either way tbh, as long as it passes the check. Other projects I work on apply automated fixes to generated files, and it occasionally squeezes out variations between different versions of the code generation dependency - but then can also introduce differences in PRs if the formatter wasn't run for some reason.
|
@Andreybest can you resolve conflicts and deal with the application of prettier to the generated files (to stop the linting check failing - see #1501 (comment)). After that this should be mergable! |
… tsoa and disable formatting
|
Checked all commits on main branch for new changes to logic for endpoints. On main new ssh routes were added, and code for routes and tests were aligned with TSOA, checked up to commit: |
|
@kriswest, conflicts resolved, new features alligned with this PR. On your comment - made a solution, please approve it, and if this works - lets go! |

Resolves #1430.
Add tsoa for endpoint type checking and generation of OpenAPI documentation. Generates
swagger.jsonto /dist folder.All tests for endpoints that were present, passes (with minor changes), all logic is preserved.
Caveats:
POST api/v1/push/{id}/reject(rejectPush), if empty or whitespaces provided, will not check for it, thus old logic for theck with.trim()is left.noImplicitAdditionalProperties, that allows to change behavior of endpoints for rejecting of excess fields. Currently set toignoredue toPOST api/v1/repo(createRepo), this endpoint passes body to adb.createRepo(body), and inner type expects additionalProperties that are passed to a row in a DB. Question: is this expected or not? If not, maybe we should enable more strict mode onnoImplicitAdditionalProperties? :)