Swagger-Codegen generates empty class instead of an instance of ByteArrayOutputStream

Viewed 387

I'm currently trying to generate an api with swagger-codegen. The only problem i have is that swagger generates an empty class with the name "ByteArrayOutputStream" instead of an instance of ByteArrayOutputStream. The generated class also contains no attributes.

The generated swagger-yaml also defines ByteArrayOutputStream like this:

  ByteArrayOutputStream:
    type: "object"

This is the relevant part of the swagger.yaml. I've replaced some of the values with "..." and shortened the file.

---
swagger: "2.0"
info:
  version: "1.0"
  title: "..."
  contact:
    name: "..."
    url: "..."
host: "..."
basePath: "/"
schemes:
- "https"
paths:
  /rest/v1/pkw:
    post:
      summary: "..."
      description: ""
      operationId: "..."
      produces:
      - "application/json"
      parameters:
      - in: "body"
        name: "body"
        required: false
        schema:
          $ref: "#/definitions/Request"
      responses:
        200:
          description: "successful operation"
          schema:
            $ref: "#/definitions/Result"
definitions:
  ByteArrayOutputStream:
    type: "object"
  Request:
    ...
  Result:
    type: "object"
    properties:
      ...
      pdf:
        $ref: "#/definitions/ByteArrayOutputStream"

2 Answers

Update: I've changed my api and replaced ByteArrayOutputStram by a String. I use Base64 encoding and decoding to do so. This helped me avoid the problems and works fine.

That's happen when you use it. You just have to overrides that class and your problem will fix.

Regards.

Related