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

Revert "fix: export of embed properties when struct type is not exported" #848

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 23, 2025

Conversation

danielgtaylor
Copy link
Owner

Reverts #822. With some additional testing this appears to not be working correctly. The stdlib JSON serializer is ignoring these private embedded fields. We should revisit this and see if there is a solution that can work.

@Copilot Copilot AI review requested due to automatic review settings June 23, 2025 04:30
Copy link
Contributor

@Copilot 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 reverts a previous fix regarding the export of embed properties for unexported struct types due to issues with the stdlib JSON serializer ignoring private embedded fields. Key changes include:

  • Removing the type definition of embedWithExported and its associated test cases.
  • Reverting modifications in the schema generation logic to exclude tests verifying serialization of unexported embedded fields.

Reviewed Changes

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

File Description
schema_test.go Removed embedWithExported type and test cases related to unexported embeds.
schema.go Simplified field filtering logic by removing redundant checks for exported status.
Comments suppressed due to low confidence (2)

schema_test.go:1329

  • The removal of TestUnexportedEmbed reduces test coverage for unexported embedded fields; consider providing an alternative test or a comment explaining why this removal is acceptable.
	err = json.Unmarshal([]byte(`{"field": null}`), &o)

schema.go:643

  • [nitpick] The inline comment referencing 'embeds can have exported fields' appears outdated after the recent change; consider updating or removing it to avoid confusion.
		if f.Anonymous {

Copy link

codecov bot commented Jun 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.47%. Comparing base (179328f) to head (fb41f02).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #848      +/-   ##
==========================================
- Coverage   92.47%   92.47%   -0.01%     
==========================================
  Files          23       23              
  Lines        5502     5501       -1     
==========================================
- Hits         5088     5087       -1     
  Misses        354      354              
  Partials       60       60              

☔ 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.

@danielgtaylor danielgtaylor merged commit e5fa153 into main Jun 23, 2025
7 checks passed
@danielgtaylor danielgtaylor deleted the revert-822-unexported-embed branch June 23, 2025 04:33
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.

1 participant