-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[docs] Document avoiding embedded structs in config structures #14340
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
[docs] Document avoiding embedded structs in config structures #14340
Conversation
Add guidelines to coding-guidelines.md explaining why embedded structs should be avoided in configuration definitions. This helps prevent unmarshal issues, naming conflicts, and improves code clarity. Fixes open-telemetry#12719
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
- Remove changelog entry (not needed for doc-only changes per dmathieu) - Add documentation about using squash tag with named fields to achieve flat YAML structure while avoiding true embedding (per evan-bradley)
|
@dmathieu I'm not aware of a linter that specifically checks for embedded structs in config files. This could be a good enhancement for the future as a custom linter rule. For now, the documentation should help maintain awareness among contributors. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #14340 +/- ##
==========================================
- Coverage 91.81% 91.79% -0.03%
==========================================
Files 679 679
Lines 42857 42857
==========================================
- Hits 39351 39340 -11
- Misses 2439 2446 +7
- Partials 1067 1071 +4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dmathieu
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need to re-request approvals for every merge with main.
|
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
7fd6565
|
Thank you for your contribution @ANAMASGARD! 🎉 We would like to hear from you about your experience contributing to OpenTelemetry by taking a few minutes to fill out this survey. |
Description
Add guidelines to coding-guidelines.md explaining why embedded structs should be avoided in configuration definitions. This helps prevent unmarshal issues, naming conflicts, and improves code clarity.
Key points added to the documentation:
UnmarshalimplementationsLink to tracking issue
Fixes #12719
Testing
Documentation only - no code changes. No testing required.
Documentation
Added new subsection "Avoid Embedded Structs" under the existing "Configuration structs" section in docs/coding-guidelines.md. The section includes: