Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-11749

Generated C# code of OpenAPI does not compile

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L2 - Critical L2 - Critical
    • 7.13.0, 7.13.0-alpha4
    • 7.13.0-alpha3
    • None
    • OpenAPI

      I have an issue with the openapi specs. Based on the JSON I'm going to assume its openapi v3.

      I've tried 3 different tools to generate a C# dotnet core client with it.

      • Swagger-gen.jar 
      • Autorest
      • NSwag

       

      All three come with the same issue on two methods which doesn't allow it to compile.

      the methods are:

      • SetExternalTaskRetriesAsync
      • ModifyProcessInstanceAsync

       

      If I look into the generated code. somehow for those two methods it has the same method with different return types which is not allowed in C# with the same name.

       

      As you can see below. the return type in the first is Task<BatchDto> and an overload that is called with the same return type.

      However in the second section you see Task without a return type. And it only happens with those two methods i sent you in the previous mail. If i look in the openapi specs i dont see anything odd, since based on the response codes it specifies that there is always a return type, so i have no idea why the three most popular sdk client generators for openapi do this making it not compile. I thought it might be worth mentioning to you. Maybe it has to do that its allowed in other languages, but its not allowed in any OO language i know that the return type can be different and the same name is used. 

       

              /// <param name="id">The id of the process instance to modify.</param>
              /// <returns>Request successful.</returns>
              /// <exception cref="ApiException">A server side error occurred.</exception>
              public System.Threading.Tasks.Task<BatchDto> ModifyProcessInstanceAsync(string id, ProcessInstanceModificationDto body)
              {
                  return ModifyProcessInstanceAsync(id, body, System.Threading.CancellationToken.None);
              }
          
              /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
              /// <param name="id">The id of the process instance to modify.</param>
              /// <returns>Request successful.</returns>
              /// <exception cref="ApiException">A server side error occurred.</exception>
              public async System.Threading.Tasks.Task<BatchDto> ModifyProcessInstanceAsync(string id, ProcessInstanceModificationDto body, System.Threading.CancellationToken cancellationToken)
              {
                  if (id == null)
                      throw new System.ArgumentNullException("id");
                  ...

       

              /// <param name="id">The id of the process instance to modify.</param>
              /// <returns>Request successful.</returns>
              /// <exception cref="ApiException">A server side error occurred.</exception>
              public System.Threading.Tasks.Task ModifyProcessInstanceAsync(string id, ProcessInstanceModificationDto body)
              {
                  return ModifyProcessInstanceAsync(id, body, System.Threading.CancellationToken.None);
              }
          
              /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
              /// <param name="id">The id of the process instance to modify.</param>
              /// <returns>Request successful.</returns>
              /// <exception cref="ApiException">A server side error occurred.</exception>
              public async System.Threading.Tasks.Task ModifyProcessInstanceAsync(string id, ProcessInstanceModificationDto body, System.Threading.CancellationToken cancellationToken)
              {
                  if (id == null)
                      throw new System.ArgumentNullException("id");
                  ...
      

       

       

        This is the controller panel for Smart Panels app

          1. swagger1.png
            68 kB
            Bernd Ruecker
          2. swagger2.png
            69 kB
            Bernd Ruecker

              nikola.koevski Nikola Koevski
              ruecker Bernd Ruecker
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: