API: taxon.defaultPhoto duplicated key in Observation

Platform: API

Screenshots of what you are seeing


Description of problem:
When querying the API for a single observation in JS with “await inatjs.observations.fetch(observation.id)” the Object retrieved has a property Observation.taxon.defaultPhoto as well as Observation.taxon.default_photo, from what I can see it gives back the identical object.

The same is true for Observation.communityTaxon and Observation.community_taxon

inaturalistjs will in some cases turn the raw API JSON into JavaScript objects with potentially additional methods and attributes. See for example the Observation model https://github.com/inaturalist/inaturalistjs/blob/main/lib/models/observation.js#L22 which creates the communityTaxon attribute as an instance of the taxon class https://github.com/inaturalist/inaturalistjs/blob/main/lib/models/taxon.js, giving the end user access to methods that class implements.

It may be an overreach for inatjs to be creating JS models, but that’s what it does and why you’re seeing additional attributes not directly present in API responses.

1 Like