sap-cloud-sdksap-successfactors

SAP OData Generator generates bad URL for navigated entries


Using the SAP V2 Code Generator we have created classes for Success Factors.

When generating a URL for a request that invokes an Navigated Entity it throws a 500 error.

PerPersonFluentHelper q = service.getAllPerPerson().select(PerPerson.TO_EMAIL_NAV);

generates $select=emailNav/*&$expand=emailNav

Trying to run that results in

message lang="en-US">Unable to understand API request with character sequence: emailNav/* at character position number: 9 invalid characters: *

I get a similar problem when/if I try to use the ALL_FIELDS static field for an entity.

If I remove the /* and paste the url into a browser it works fine.

We are looking for any solutions. Have already spent days reading blogs and running searches.

Is there an advanced documentation on the use of the generated classes?

Thanks in advance.

FOUND A SOLUTION -- Found a away around the problem by cloning the FluentHelperBasic class and doing the following:

for (int i = 0; i < selections.size(); i++) {
        String select = selections.get(i);
        if (select.endsWith("/*")) {
            selections.set(i, select.substring(0,select.length()-2));
        }
    }
fieldNames.addAll(selections);
selections.forEach(delegateSelect);

this code needs to be moved AFTER the code setting delegate expansion.


Solution

  • Unfortunately SFSF does not accept the * as a selector for all fields. You can work around this by declaring all fields of the property to be expanded in the select clause:

    select(PerPerson.TO_EMAIL_NAV.select(Email.FIELD_1, Email.FIELD_2));