Skip to content

Map missing arrays from nil to [] ? #36

@eiked

Description

@eiked

release = discogs.get_release(...)

sometimes includes release.identifiers but sometimes does not.
(aka release.identifiers == nil)

I'd like to suggest to add some postprocessing to the Discogs::Wrapper
aka: release.identifiers=nil should automagically be mapped to release.identifiers={}

And let's look up all other pieces of the responses where such things might happen.

One might argue, that nil is the proper value here and we should not mess with this.

But on the other hand, the wrapper is ment to make life easy,
and it would be much more convenient, DRY and fool proof.

So actually the contract for release.identifiers would change from:
"might also return nil" to "always returns a hash"
which lessens the clients of the api to check for nil.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions