Forum Discussion

kdynan's avatar
kdynan
Occasional Visitor
4 years ago

Response error schema code generation

Hello, I am trying to generate a csharp client using Swagger 2.0 and Swagger Codegen v2.4.21.  My Swagger file describes API responses with different schemas based on status codes:

 

responses:
        200:
          description: "successful operation"
          schema:
            type: "array"
            items:
              $ref: "#/definitions/AppointmentAddResult"
        400:
          description: "Bad request"
          schema:
            $ref: "#/definitions/BatchAppointmentAddErrorBody"

 

  Models are generated for both schemas, however the model for the 400 response code is not used anywhere in the generated client.  Is this expected behavior?  I would have expected code to be generated to actually create objects based on the JSON returned with the 400 status code.  Any help would be greatly appreciated.  Thanks.

No RepliesBe the first to reply