<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: CAP OpenAPI Generator for OData V4 Functions in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355967#M4627069</link>
    <description>&lt;P&gt;ping  &lt;SPAN class="mention-scrubbed"&gt;ralf.handl&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;christian.georgi&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;joerg.mann&lt;/SPAN&gt; &lt;/P&gt;</description>
    <pubDate>Tue, 23 Feb 2021 07:28:05 GMT</pubDate>
    <dc:creator>aparr</dc:creator>
    <dc:date>2021-02-23T07:28:05Z</dc:date>
    <item>
      <title>CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaq-p/12355963</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
  &lt;P&gt;When generating an openapi file for an SAP Cloud Application Programming Model Service via cds compile Swagger API uses a wrong URL to call that OData V4 function. Is that an know bug or limitation or am i doing something wrong?&lt;/P&gt;
  &lt;P&gt;CDS Service definition&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;service Substitute @(requires : 'ApiUser') {

    type SubstituteWrapper {
        Matnr      : String(18);
        Sugrd      : String(4);
        Material {
            Matwa  : String(18);
            Mstav  : String(2);
            Vmsta  : String(2);
        };
        Substitute : {
            Mstav  : String(2);
            Smatn  : String(18);
            Vmsta  : String(2);
        };
    }

   function GetSubstitute(
                           Matnr : String(18) not null,
                           Sugrd : String(4) null ,
                           VkOrg : String(4) null ,
                           VtWeg : String(2) null ,
                           Kschl : String(4) null ,
                           Kappl : String(2) null)) 
     returns               SubstituteWrapper;
}

&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Which results in the following URLs when using Swagger UI:&lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;substitute/GetSubstitute?Matnr=389951&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;But should be like &lt;/P&gt; 
  &lt;PRE&gt;&lt;CODE&gt;substitute/GetSubstitute(Matnr='389951',Sugrd='',VkOrg='0100',VtWeg='20',Kschl='',Kappl='')&lt;/CODE&gt;&lt;/PRE&gt;
  &lt;P&gt;Any idea on this?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 14:25:02 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaq-p/12355963</guid>
      <dc:creator>aparr</dc:creator>
      <dc:date>2021-01-18T14:25:02Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355964#M4627066</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;ralf.handl&lt;/SPAN&gt; can you shed a light on whether function calls like above is already covered by the OpenAPI converter?&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;joerg.mann&lt;/SPAN&gt; FYI&lt;/P&gt;</description>
      <pubDate>Mon, 18 Jan 2021 15:58:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355964#M4627066</guid>
      <dc:creator>chgeo</dc:creator>
      <dc:date>2021-01-18T15:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355965#M4627067</link>
      <description>&lt;P&gt;Generating an openapi file for your service with CAP 4.4.10 produces&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;  "paths": {
    "/GetSubstitute(Matnr='{Matnr}',Sugrd='{Sugrd}',VkOrg='{VkOrg}',VtWeg='{VtWeg}',Kschl='{Kschl}',Kappl='{Kappl}')": {
      "get": {
        "summary": "Invoke function GetSubstitute"
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Which is what you expect.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 12:19:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355965#M4627067</guid>
      <dc:creator>RalfHandl</dc:creator>
      <dc:date>2021-01-27T12:19:45Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355966#M4627068</link>
      <description>&lt;P&gt;Thanks  &lt;SPAN class="mention-scrubbed"&gt;ralf.handl&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;I wondered why my openapi json file is different from yours and I saw that I removed some core annations in the cds file in order the keep the sample a little bit cleaner but this causes the url to change.&lt;/P&gt;&lt;P&gt;By adding annoation Core : {OptionalParameter : {$Type : 'Core.OptionalParameterType'}} the url changes. Full sample:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;function GetSubstitute(Matnr : String(18) not null,
                                   Sugrd : String(4) null @(
                                                              description : 'Reason',
                                                              Core        : {OptionalParameter : {$Type : 'Core.OptionalParameterType'}}
                                                          ),
                                   VkOrg : String(4) null ,
                                   VtWeg : String(2) null ,
                                   Kschl : String(4) null ,
                                   Kappl : String(2) null 
                                   ) 
    returns SubstituteWrapper;&lt;BR /&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This changes the url to /GetSubstitute and removes the other parts needed to build up a valid OData V4 request, right?&lt;/P&gt;&lt;P&gt;Why did I add that annotation:&lt;/P&gt;&lt;P&gt;I like to mark mandatory and optional parameters of the function. 'null' and 'not null' keywords of the function parameters are not considered when creating the openapi file?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Alex&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jan 2021 14:26:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355966#M4627068</guid>
      <dc:creator>aparr</dc:creator>
      <dc:date>2021-01-27T14:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355967#M4627069</link>
      <description>&lt;P&gt;ping  &lt;SPAN class="mention-scrubbed"&gt;ralf.handl&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;christian.georgi&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;joerg.mann&lt;/SPAN&gt; &lt;/P&gt;</description>
      <pubDate>Tue, 23 Feb 2021 07:28:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355967#M4627069</guid>
      <dc:creator>aparr</dc:creator>
      <dc:date>2021-02-23T07:28:05Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355968#M4627070</link>
      <description>&lt;P&gt;Hello  &lt;SPAN class="mention-scrubbed"&gt;ralf.handl&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;christian.georgi&lt;/SPAN&gt;  &lt;SPAN class="mention-scrubbed"&gt;joerg.mann&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;Could you please provide a sample for a function with an optional parameter which is considered in the OpenAPI File as well?&lt;/P&gt;&lt;P&gt;Best&lt;/P&gt;&lt;P&gt;Alex&lt;/P&gt;</description>
      <pubDate>Tue, 13 Apr 2021 06:47:37 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355968#M4627070</guid>
      <dc:creator>aparr</dc:creator>
      <dc:date>2021-04-13T06:47:37Z</dc:date>
    </item>
    <item>
      <title>Re: CAP OpenAPI Generator for OData V4 Functions</title>
      <link>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355969#M4627071</link>
      <description>&lt;P&gt;The suffix null only tells that null is an allowed parameter value, the parameter is still required in the request URL, e.g. as Sugrd=null.&lt;/P&gt;&lt;P&gt;Optional parameters in the sense that you can omit them from the request URL are marked with the annotation Core.OptionalParameter. This then implies sending the parameters in the query part of the URL.&lt;/P&gt;&lt;P&gt;See example 94 in &lt;A href="https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_InlineParameterSyntax" target="test_blank"&gt;https://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-protocol.html#sec_InlineParameterSyntax&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Apr 2021 07:17:15 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/cap-openapi-generator-for-odata-v4-functions/qaa-p/12355969#M4627071</guid>
      <dc:creator>RalfHandl</dc:creator>
      <dc:date>2021-04-14T07:17:15Z</dc:date>
    </item>
  </channel>
</rss>

