Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expected to resource at path my/accounts to yield a NSDictionary, but got instead got ... #1

Open
0xTomTom opened this issue Aug 30, 2017 · 1 comment

Comments

@0xTomTom
Copy link

0xTomTom commented Aug 30, 2017

When performing a default OBPMarshal request with getResourceAtAPIPath to "my/accounts", the HandleOBPMarshalError is called with the following:

Expected to resource at path my/accounts to yield a NSDictionary, but got instead got:
(
        {
        "account_routing" =         {
            address = 1233;
            scheme = OBP;
        };
        "bank_id" = rbs;
        id = 1233;
        label = "<null>";
    }
)
from body: [{"id":"1233","label":null,"bank_id":"rbs","account_routing":{"scheme":"OBP","address":"1233"}}]

The response seems valid and expected, but isn't usable as the MarshalError is called in stead of HandleOBPMarshalData

I've used the following:
let serverBase = "https://apisandbox.openbankproject.com/obp/v3.0.0/"
session.marshal.getResourceAtAPIPath("my/accounts", withOptions: nil, forResultHandler: resultHandler, orErrorHandler: errorHandler)

@t0rst
Copy link
Contributor

t0rst commented Sep 1, 2017

Hi Tom,

You can easily tell OBPMarshal to expect a different container type (or no container type) using the OBPMarshalOptionExpectClass options key:

session.marshal.getResourceAtAPIPath("my/accounts", 
    withOptions: [ OBPMarshalOptionExpectClass : NSArray.self ], 
    forResultHandler: resultHandler, orErrorHandler: errorHandler)

...and there are more options for handling unusual cases here: https://github.com/OpenBankProject/OBPKit-iOSX#customising-obpmarshal-behaviour

If you find more uncatered-for edge cases, let me know. 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants