swagger-api/swagger-codegen

Swagger codegen generates a nullable integer as method return value in SDK for operation that returns an integer

Open

#6,872 opened on Nov 2, 2017

View on GitHub
 (8 comments) (1 reaction) (0 assignees)HTML (12,701 stars) (5,474 forks)batch import
Client: C-SharpEnhancement: GeneralGeneral: Questionhelp wanted

Description

Description

I have an operation which returns an integer, and when I generate a C# SDK using codegen, the method associated with the operation returns a nullable integer instead of an integer. I tried to set the produced response schema as required using an operation filter and setting the default value as 0 but it had no effect.

Here is the definition of my operation responses:

       "responses":{  
           "200":{  
              "description":"Success",
              "schema":{  
                 "format":"int32",
                 "default":0,
                 "required":[  
                    "200"
                 ],
                 "type":"integer"
              }
           }
        }

Thank you for any insight

Contributor guide