fix(emissions): update eMapsZonesResponse to match current Electricity Maps API#468
Merged
mahendrapaipuri merged 1 commit intoceems-dev:mainfrom Feb 25, 2026
Conversation
…y Maps API The /v3/zones endpoint now returns non-string typed fields (arrays,booleans, nullable strings) which cannot be unmarshaled into map[string]map[string]string. Replace with a proper struct.
Collaborator
|
Thanks a lot @samoz83 for the PR. Really appreciate it!! Could you confirm me that this patch works as expected for you? If so, I will cut a release with this PR. Cheers!! |
Contributor
Author
|
Yep, I can confirm that my node is now running the exporter and not failing to start due to the unmarshal array issue and pulling in emaps data: |
Collaborator
|
Awesome @samoz83 Cheers again for the PR. Let me merge it and make a new release! |
Collaborator
|
Between, are you using CEEMS in production @samoz83 ? If so, could I add that to the list of adopters? Cheers!! |
Contributor
Author
|
@mahendrapaipuri Sure, we are using it in production on our AI@Surrey cluster at the University of Surrey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #467
Problem
The Electricity Maps
/v3/zonesendpoint has changed its response schema. Zone objects now contain non-string typed fields:subZoneKeys[]string(array)isCommerciallyAvailableboolzoneParentKeystring | nulltierstring | nullThe current type
eMapsZonesResponseis defined asmap[string]map[string]string, sojson.Unmarshalfails when it encounters these non-string values:json: cannot unmarshal array into Go value of type stringThis prevents
ceems_exporterfrom starting when the [maps emissions provider is enabled.Changes
eMapsZonesResponsefrommap[string]map[string]stringtomap[string]eMapsZoneDetails, adding a new eMapsZoneDetails struct that properly models the current API response.details.CountryName,details.ZoneName) instead of map indexing.Testing
All existing emissions tests pass and ceems_exporter runs: