kbase / dts

A data transfer service
https://kbase.github.io/dts/
MIT License
0 stars 0 forks source link

Updated service prototype with new API framework. #58

Closed jeff-cohere closed 4 months ago

jeff-cohere commented 5 months ago

This is my first stab at using Huma to implement the endpoints for the DTS. Huma frames things more explicitly in terms of input (for requests) and output (for responses) in a way that allows the definition and use of structs annotated with tags. These tags can include documentation (with examples), and remove a lot of marshalling/unmarshalling boilerplate code. I quite like how it feels so far, but I think it needs another pair of eyes before we adopt it.

The motivation for this PR wasn't actually all this cleanup and additional explication. It turns out that Huma can take the struct annotations for the various endpoints and requests and turn them into a fully OpenAPI-compliant documentation site! I was doing this with a manually written openapi.yaml file (blecch!) and some file-embedding trickery, and this is definitely much nicer.

I'm planning on testing this in NERSC Spin. But I wanted to get this up before going too much further. If we do end up going in this direction, I'll work on polishing the generated documentation.

NOTE: This PR also updates other dependencies, which makes it look bigger than it really is.

Some examples of generated REST API docs:

root-endpt databases-endpt database-endpt search-endpt transfers-endpt transfer-status-endpt

Closes #55

github-actions[bot] commented 5 months ago

PR Preview Action v1.4.7 :---: :rocket: Deployed preview to https://kbase.github.io/dts/pr-preview/pr-58/ on branch gh-pages at 2024-04-18 20:15 UTC

codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 82.45614% with 20 lines in your changes are missing coverage. Please review.

Project coverage is 57.63%. Comparing base (9f2f833) to head (cca4bcd).

:exclamation: Current head cca4bcd differs from pull request most recent head 16c3716. Consider uploading reports for the commit 16c3716 to get more accurate results

Files Patch % Lines
services/prototype.go 82.45% 17 Missing and 3 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #58 +/- ## ========================================== + Coverage 56.96% 57.63% +0.67% ========================================== Files 16 15 -1 Lines 2349 2233 -116 ========================================== - Hits 1338 1287 -51 + Misses 834 783 -51 + Partials 177 163 -14 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jeff-cohere commented 5 months ago

I've verified that this updated version of the DTS works properly in Spin, just like the old one.