这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@mumu1000
Copy link
Contributor

This simple patch allows to explicitly set the "example" tag of fields in both params an schemas to the empty string "" .

@codecov
Copy link

codecov bot commented Mar 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.10%. Comparing base (4977a7a) to head (3cbc681).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #773   +/-   ##
=======================================
  Coverage   93.10%   93.10%           
=======================================
  Files          23       23           
  Lines        5296     5296           
=======================================
  Hits         4931     4931           
  Misses        313      313           
  Partials       52       52           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Owner

@danielgtaylor danielgtaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! 👍

@danielgtaylor danielgtaylor requested a review from Copilot March 29, 2025 16:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes the handling of the "example" tag on fields so that it can be explicitly set to an empty string in both params and schemas.

  • Updates the tag parsing in schema.go to use Lookup instead of Get
  • Applies a similar update in huma.go to maintain consistency

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
schema.go Changed tag retrieval for "example" to use Lookup, allowing empty string values.
huma.go Adjusted tag retrieval for "example" to use Lookup, ensuring consistency with schema.
Comments suppressed due to low confidence (2)

schema.go:561

  • [nitpick] Consider renaming the variable 'present' to 'ok' to better align with Go idioms, and remove the extra space before the comma.
if value , present := f.Tag.Lookup("example"); present {

huma.go:166

  • [nitpick] Consider renaming the variable 'present' to 'ok' for consistency with common Go practices, and remove the extra space before the comma.
if value , present := f.Tag.Lookup("example"); present {

@danielgtaylor danielgtaylor merged commit fc2d45e into danielgtaylor:main Mar 29, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants