Skip to content

Proposal: Add Field Export Check in EDF Structure Registration to Align with Documentation #209

Open
@chopdown

Description

@chopdown

According to the EDF documentation (https://docs.ergo.services/networking/network-transparency#edf-ergo-framework-data-format):
"All child elements in the registered structures must be public. If you need to encode/decode structures with private fields, you will need to implement a custom encoder/decoder for that data type."

However, based on my testing and code review (

ft := tov.Field(i).Type
), there appears to be no check for field.IsExported() in the current implementation. This leads to situations where structures containing private fields (which shouldn't be included in serialization/deserialization) will eventually throw errors during processing.

Should we add the corresponding exported field check to align with the documentation? This would help prevent unintended exposure of private fields and match the framework's design specifications.

Activity

halturin

halturin commented on Mar 6, 2025

@halturin
Collaborator

Good catch. Sure, it needs to be checked on the registration. Would you mind making a PR (with a unit-test for this case)?

chopdown

chopdown commented on Mar 6, 2025

@chopdown
Author

I've submitted a PR (#210 ) to address the issue.

As I'm still learning Go, there might be areas where I missed idiomatic patterns or best practices. Please feel free to point out any adjustments needed in the PR review — whether it's code structure, error handling, or style preferences. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @halturin@chopdown

        Issue actions

          Proposal: Add Field Export Check in EDF Structure Registration to Align with Documentation · Issue #209 · ergo-services/ergo