Search code examples
sap-cloud-sdk

Does OpenAPI client Generator of SAP Cloud SDK supports extensibility fields?


We replicate data from Sales Cloud V2 system to our micro service and our services bases on java. Therefore we use the SAP Cloud SDK openAPI generator, which works fine.

In Sales Cloud V2 for some entities the customer has the possibility to add extensibility fields to an entity. for instance contact. This extensibility fields are also exposed in the corresponding service and openAPI definition.

For instance when a customer has added extension fields then the schema for the contact person of the extension fields can be found underneath extensions:

        "ContactPersonqueryresponse": {
            "title": "ContactPerson query response",
            "type": "object",
            "properties": {
                "count": {
                    "type": "integer",
                    "format": "int32"
                },
                "value": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string",
                                "format": "uuid"
                            },
                            "displayId": {
                                "type": "string"
                            },
                ...
                            },
                            "extensions": {
                                "type": "object",
                                "properties": {
                                    "linkedinprofile_lf0wwm40": {
                                        "type": "string",
                                        "format": "uri"
                                    },
                                    "additionalacademictitle_lf8bbolv": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },

When we generate the models and api client for contact person in our java project we do not have information about the extension fields at customer site. Meaning our openAPI definition file has no fields unterneath extensions.

The issue we face is that we cannot get the extension fields and its value of our customer in Get operation.

We were not able to find documentation or hint in community to overcome the issue.

Is there a way to get extension fields, which are not part of the schema respectively generated model ?

Thanks for your help in advance.

Best Regards, Axel


Solution

  • OpenAPI generated objects can now read custom fields which are not part of the object's schema:

    • getCustomFieldNames()
    • getCustomField("nameOfField")

    This feature has been added to version 4.14.0 of the SAP Cloud SDK