Allow providing name hints using tags for anonymous body structs#416
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #416 +/- ##
==========================================
+ Coverage 92.65% 92.73% +0.08%
==========================================
Files 21 21
Lines 3539 3552 +13
==========================================
+ Hits 3279 3294 +15
+ Misses 221 220 -1
+ Partials 39 38 -1 ☔ View full report in Codecov by Sentry. |
danielgtaylor
left a comment
Owner
There was a problem hiding this comment.
This is awesome, thank you!
danielgtaylor
approved these changes
Apr 28, 2024
wolveix
added a commit
that referenced
this pull request
Feb 15, 2026
Add docs for `nameHint` tag (#416)
Merged
wolveix
added a commit
that referenced
this pull request
Feb 16, 2026
* Stop reusing schema objects in $schema field Support multiple docs renderers Add RegistryConfig * Stop setting example in schema and param (fix #946) * Support DocsRendererSwaggerUI Add docs for `nameHint` tag (#416) * Bump dependencies Removed outdated example humachi.NewV4 call * Run `go fix` * Add tests for docs renderers * Update Go version in secondary READMEs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Small change introducing the possibility to provide name hints for request/response body through struct tags. Previously discussed in #322
Example:
Because it defines a name hint, it only applies to anonymous types. We could go further and allow overriding the name altogether but that would involve changing the schema namer interface (
func (t reflect.Type, hint string) string) to include one more parameter, which might break backward compatibility.