Search code examples
odatasap-cloud-sdksap-gateway

Map sap:quickinfo into generated Java entity with odata-core


I create an OData client from an EDMX file using com.sap.cloud.sdk.datamodel.odata-core (https://sap.github.io/cloud-sdk/docs/java/features/odata/generate-typed-odata-v2-and-v4-client-for-java).

My EDMX file contains the properties with sap:quickinfo values like

<Property Name="NAME" sap:label="C-Name" sap:heading="CUST" sap:quickinfo="Customer Name" [...] >

The generated fields looks like this

    @SerializedName("NAME")
    @JsonProperty("NAME")
    @Nullable
    @ODataField(odataName = "NAME")
    private String nAME;

and I need an additional annotation like @Quickinfo("Customer Name").

Is there any way I can get this quickinfo mapped into an annotation to the generated entity?

I use this parameters for the generator:

           <plugin>
                <groupId>com.sap.cloud.sdk.datamodel</groupId>
                <artifactId>odata-generator-maven-plugin</artifactId>
                <version>3.52.0</version>
                <executions>
                    <execution>
                        <id>generate-consumption</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputDirectory>${project.basedir}/sap/</inputDirectory>
                            <outputDirectory>${project.build.directory}/generated-sources/sap/</outputDirectory>
                            <deleteOutputDirectory>true</deleteOutputDirectory>
                            <packageName>app.customers</packageName>
                            <defaultBasePath>sap/opu/odata/SAP/</defaultBasePath>
                            <compileScope>COMPILE</compileScope>
                            <serviceMethodsPerEntitySet>false</serviceMethodsPerEntitySet>
                            <nameSource>NAME</nameSource>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Solution

  • Disclaimer: I'm a member of the SAP Cloud SDK for Java development team.

    The SAP Cloud SDK's OpenApi generator is a wrapper of the open source OpenApi Generator (we are using version 5.0.0-beta3). Therefore, our wrapper supports only features that are also supported by the mentioned open source variant.

    Unfortunately, creating arbitrary Attribute classes for properties of the service specification is not a supported feature as of now.