question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generated oData v2 VDM: DeSerializing of requests with sub-sub-selects not working as expected

See original GitHub issue

Describe the bug I am using a generated Virtual Data Model to call an onPremise system oData v2 API and to fetch Customer data. It’s all working and I am able to interact and establish a connection. As soon as I am adding .select() statements, having sub-sub-selects, the data is coming from ERP (like expected) but the deSerializing isn’t working anymore. The sub-sub-select entity and its properties are coming up as customFields instead.

To Reproduce The following call is showing the sub-sub-select statement:

const haystack2 = await customerSetApi.requestBuilder().getAll()
 .top(1)
 .select(customerSetApi.schema.ALL_FIELDS,            
     customerSetApi.schema.TO_CUSTOMER_CONTACT.select(customerContactSetApi.schema.ALL_FIELDS),
     customerSetApi.schema.TO_CUSTOMER_SALES.select(customerSalesSetApi.schema.ALL_FIELDS),
     customerSetApi.schema.TO_CUSTOMER_SALES.select(customerSalesSetApi.schema.TO_CUSTOMER_SALES_PARTNER.select(customerSalesPartnerSetApi.schema.ALL_FIELDS)),
     customerSetApi.schema.TO_CUSTOMER_SALES.select(customerSalesSetApi.schema.TO_CUSTOMER_SALES_MULTI_LANGUAGE.select(customerSalesMultiLanguageSetApi.schema.ALL_FIELDS)))
 .execute({ destinationName: config.get('DESTINATIONS.CLOUDCONNECTOR'), useCache: true })           
 console.log('Using default deSerializer this should be feasible as well: ')
 console.log(haystack2[0].toCustomerSales[0].toCustomerSalesPartner[0]);

Expected behavior I do expect the deSerializing of the oData v2 response will be provided for sub-sub-selects in the same way it’s done for selects and sub-selects. The data of “TO_CUSTOMER_CONTACT” and also for “TO_CUSTOMER_SALES” is getting deSerialized like expected, it’s just the sub-sub-selects who are missing and do appear as customFields 😦

Screenshots The first screenshot shows that the data is available and the request is working. Not deSerialized, it’s all fine and the json contains all selected data, within sub-sub-selects: CusomterSalesPartner_data_existing

The deSerialized approach shows you the sub-sub-selected data isn’t going to be deSerialized like expected, but added as customFields instead: CustomerSalesPartner_as_customField

Used Versions:

Impact / Priority

This is blocking default capabilities and within our planed migration to SAP Cloud SDK v2. Timeline of project: Go Live end of july.

Do not hesitate to ask more details or schedule a short session to get a deep-dive about it. Thanks and Kind regards, Cedric

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
drvupcommented, Jun 28, 2022

Hey @jjtang1985 , thx for the feedback. I checked immediately and yes, you’re right. It’s working this way. So the reason is about the new instances only?

Maybe it’s worth it writing some lines on your documentation page 😉

I mean … as I already shared with you, I am updating from SAP Cloud SDK v1 to v2 and I guess I am just one of the first who is doing this so maybe it’s worth it saving time, energy and frustration from others by updating this information hehe

Thanks again! Good job!

1reaction
jjtang1985commented, Jun 28, 2022

Hi @drvup,

Thank you very much for your feedback. Sure, we’ll update our documentation page;)

Best regards, Junjie

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resolving date serialization issues when using an external ...
To resolve this issue I had to make sure to return OData v4 compatible values when reading data and to supply OData v2...
Read more >
Use the OData v2 Type-safe Client API | SAP Cloud SDK
Use SAP Cloud SDK for Java to build and run OData v2 requests in a type-safe way.
Read more >
Support board - GitHub
Code · Issues · Pull requests · Discussions · Actions · Projects · Security · Insights.
Read more >
Operations (OData Version 2.0) · OData - the Best Way to REST
To retrieve a property value using one of the OData formats a client issues an HTTP request against the property URI, and uses...
Read more >
Deserializing OData.Error messages - Stack Overflow
However, the deserialized object always has a value of null , which means that the conversion is not working as expected. That being...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found