danielgtaylor / huma

Huma REST/HTTP API Framework for Golang with OpenAPI 3.1
https://huma.rocks/
MIT License
1.87k stars 138 forks source link

Feature add converter for user types #438

Open ross96D opened 3 months ago

ross96D commented 3 months ago

fix #433

codecov[bot] commented 3 months ago

Codecov Report

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

Project coverage is 92.60%. Comparing base (e089398) to head (c2e4242).

Files Patch % Lines
huma.go 96.34% 6 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #438 +/- ## ========================================== - Coverage 92.76% 92.60% -0.16% ========================================== Files 21 21 Lines 3567 3599 +32 ========================================== + Hits 3309 3333 +24 - Misses 220 226 +6 - Partials 38 40 +2 ```

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

danielgtaylor commented 3 months ago

@ross96D thanks for the PR. I was looking into this one last night and wanted to give a brief update. I think you correctly identified a problem with custom param validation. I'm not sure a second method to convert from []byte is the best approach, so I'm thinking about what would be best for this feature. I thought about a custom Validate method but it wouldn't be used for body validation as that happens before the inputs are parsed into the struct values. 🤔 ... We could just return a value via some method so it can be used for validation. I'll try to propose something for this soon.

victoraugustolls commented 3 months ago

Could we add docs for this?