Skip to content

Support UnmarshalJSON for ExporterType#3565

Merged
StephenButtolph merged 10 commits intoava-labs:masterfrom
RodrigoVillar:add-unmarshal-for-exportertype
Apr 30, 2025
Merged

Support UnmarshalJSON for ExporterType#3565
StephenButtolph merged 10 commits intoava-labs:masterfrom
RodrigoVillar:add-unmarshal-for-exportertype

Conversation

@RodrigoVillar
Copy link
Copy Markdown
Contributor

@RodrigoVillar RodrigoVillar commented Nov 22, 2024

Why this should be merged

Currently, if you try calling json.Marshal() and json.Unmarshal() on a field of type ExporterType, this will fail as, when unmarshaling, it will try to convert a string (e.g. "grpc", "http", "unknown") into a byte.

This is solved by adding a useful default value to the type and implementing UnmarshalJSON.

How this works

This PR fixes the above by adding an UnmarshalJSON(), which handles conversions from the strings mentioned above to their respective ExporterType value.

How this was tested

Added unit tests.

Need to be documented in RELEASES.md?

Modified configs have been documented.

Comment thread trace/exporter_type.go Outdated
Comment thread trace/exporter_type.go Outdated
Comment thread trace/exporter_type.go
Comment thread trace/exporter_type.go
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 5, 2025

This PR has become stale because it has been open for 30 days with no activity. Adding the lifecycle/frozen label will cause this PR to ignore lifecycle events.

@github-actions github-actions bot added the lifecycle/stale Inactive for 60 days label Jan 5, 2025
@StephenButtolph StephenButtolph changed the title Add unmarshal for ExporterType Support UnmarshalJSON for ExporterType Apr 30, 2025
@StephenButtolph StephenButtolph added this pull request to the merge queue Apr 30, 2025
Merged via the queue into ava-labs:master with commit acb9fe6 Apr 30, 2025
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lifecycle/stale Inactive for 60 days

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants